From: | Euler Taveira de Oliveira <euler(at)timbira(dot)com> |
---|---|
To: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, meskes(at)postgresql(dot)org |
Subject: | ecpg crash |
Date: | 2008-05-10 03:14:57 |
Message-ID: | 48251331.6070706@timbira.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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/
Attachment | Content-Type | Size |
---|---|---|
crash.diff | text/x-patch | 706 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-05-10 03:41:00 | Re: Setting a pre-existing index as a primary key |
Previous Message | Alvaro Herrera | 2008-05-10 03:06:54 | Re: gsoc08, text search selectivity, pg_statistics holding an array of a different type |