Hi,
While i'm working on a ecpg patch I found a bug in ecpg code. The simple
program above could reproduce it. But basically it crashes (segfault)
because it's trying to use a inexistent connection when we're preparing
a statement. Don't know if it deserves a ecpg_log() message. A possible
fix is attached.
#include <stdio.h>
exec sql whenever sqlerror sqlprint;
int main(void)
{
exec sql begin declare section;
char cmd[128];
exec sql end declare section;
exec sql connect to euler as main;
sprintf(cmd, "select * from foo");
exec sql prepare f from :cmd;
exec sql disconnect;
return 0;
}
(gdb) bt
#0 0xb7ebd9cd in find_prepared_statement (name=0x8048819 "f", con=0x0,
prev_=0xbfccc6dc) at
/a/pgsql/dev/pgsql/src/interfaces/ecpg/ecpglib/prepare.c:187
#1 0xb7ebd79f in ECPGprepare (lineno=15, connection_name=0x0,
questionmarks=0, name=0x8048819 "f", variable=0xbfccc72c "select * from
foo limit 1,2")
at /a/pgsql/dev/pgsql/src/interfaces/ecpg/ecpglib/prepare.c:128
#2 0x0804865d in main ()
--
Euler Taveira de Oliveira
http://www.timbira.com/
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers