pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jürgen Cappel <email@juergen-cappel.de>
To: pgsql-interfaces <pgsql-interfaces@postgresql.org>
Subject: ECPG Segfault and variable usage question.
Date: Thu, 12 Feb 2004 20:00:12 +0100
Message-ID: <JEEKIPNAKJNCFLMOBKHGAEEEDCAA.email@juergen-cappel.de> (raw)

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




view thread (7+ messages)  latest in thread

Message-ID: <JEEKIPNAKJNCFLMOBKHGAEEEDCAA.email@juergen-cappel.de>
Permalink:  ../JEEKIPNAKJNCFLMOBKHGAEEEDCAA.email@juergen-cappel.de/
Also on:    postgresql.org/message-id/JEEKIPNAKJNCFLMOBKHGAEEEDCAA.email@juergen-cappel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: email@juergen-cappel.de
  Subject: Re: ECPG Segfault and variable usage question.
  In-Reply-To: <JEEKIPNAKJNCFLMOBKHGAEEEDCAA.email@juergen-cappel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox