c*****t 发帖数: 1879 | 1 写 stored procedure 的时候,发现 sprintf, elog, ereport 等统统
会造成 crash 。可是 8.2.6 底下好好的。比如
strcpy (buffer, "test"); 执行没问题,但是
sprintf (buffer, "%s", "test"); 就 crash。
例如:
CREATE FUNCTION TCDB.t_create_table(cstring) RETURNS void
AS '/projects/workspace/tcdb/src/server/libmy_utils.dll', 't_create_table'
LANGUAGE C STRICT;
Datum t_create_table (PG_FUNCTION_ARGS)
{
char buffer[8192];
sprintf (buffer, "%s", "test"); // 这一行 crash
// strcpy (buffer, "test"); 没问题
puts (buffer | c*********3 发帖数: 197 | 2 我用8.2.6; 刚接触PostgreSQL的C functions. 感觉是不一样。不一定是sprintf的问
题。初使化一下buffer试一下 | c*****t 发帖数: 1879 | 3 Not that problem. The problem was library builder mismatch
(8.3 distribution was built using VC++, 8.2.6 was built using
MinGW).
【在 c*********3 的大作中提到】 : 我用8.2.6; 刚接触PostgreSQL的C functions. 感觉是不一样。不一定是sprintf的问 : 题。初使化一下buffer试一下
| c*********3 发帖数: 197 | |
|