X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7AE59D1C9CF for ; Thu, 12 Feb 2004 18:59:53 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 50343-03 for ; Thu, 12 Feb 2004 14:59:46 -0400 (AST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by svr1.postgresql.org (Postfix) with ESMTP id 704D8D1B897 for ; Thu, 12 Feb 2004 14:59:29 -0400 (AST) Received: from [212.227.126.162] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1ArM3O-0006I4-00 for pgsql-interfaces@postgresql.org; Thu, 12 Feb 2004 19:59:14 +0100 Received: from [80.128.79.93] (helo=FRITZweb) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1ArM3O-0008Qz-00 for pgsql-interfaces@postgresql.org; Thu, 12 Feb 2004 19:59:14 +0100 From: =?iso-8859-1?Q?J=FCrgen_Cappel?= To: "pgsql-interfaces" Subject: ECPG Segfault and variable usage question. Date: Thu, 12 Feb 2004 20:00:12 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:18ffa34e0aa20c651c9363a5f5f711d8 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/33 X-Sequence-Number: 4726 Hello, this is a code snippet that causes ECPG to segfault. It's quite tricky to produce, as changing the variable name from 'var' to 'myvar' already causes things to compile fine ... #define CHAR_LENGTH 25 myfunction () { EXEC SQL BEGIN DECLARE SECTION; char var[2*CHAR_LENGTH]; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE mycursor CURSOR FOR SELECT att1, att2 FROM mytable WHERE att1 LIKE :var ESCAPE '\\'; EXEC SQL OPEN mycursor; } Stack trace was obtained using a snapshot from about 2 weeks ago, ECPG from the 7.4.1 release segfaults also. #0 0x4015fdcb in chunk_free () from /lib/libc.so.6 #1 0x4015fc53 in free () from /lib/libc.so.6 #2 0x080685b7 in dump_variables (list=0x80c1408, mode=1) at variable.c:405 #3 0x08066d56 in output_statement ( stmt=0x80c14f8 "declare mycursor cursor for select att1 , att2 from mytable where att1 like ? escape '\\\\' ", mode=0, con=0x0) at output.c:126 #4 0x0804af02 in yyparse () at preproc.y:780 #5 0x0806671d in main (argc=8, argv=0xbffff264) at ecpg.c:409 #6 0x401089ed in __libc_start_main () from /lib/libc.so.6 Another problem that's giving me headaches trying to find a workaround for is the following use of variables as data sources in INSERT/UPDATE statements: :myarray[index[10]] Any comments, suggestions, hints ? Thanks a lot, Jürgen