pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ecpg with nested structure
2+ messages / 2 participants
[nested] [flat]

* ecpg with nested structure
@ 2003-12-27 07:36  Jürgen Cappel <email@juergen-cappel.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Jürgen Cappel @ 2003-12-27 07:36 UTC (permalink / raw)
  To: pgsql-interfaces

Hello,

while porting an application from CA/Ingres to PostgreSQL
I came across a segmentation fault by ecpg. The code looks
something like this:


EXEC SQL BEGIN DECLARE SECTION;
struct bnd_a
{
    struct bnd_b
    {
	char myvar[31];
    } bnd_b[5];
} bnd_a[5];
EXEC SQL END DECLARE SECTION;

myfunction()
{
    EXEC SQL DECLARE mycursor CURSOR FOR
	     SELECT mycolumn FROM mytable;
    EXEC SQL OPEN mycursor;
    EXEC SQL FETCH mycursor
	     INTO :bnd_a[0].bnd_b[0].myvar;
    EXEC SQL CLOSE mycursor;
}


Versions are:

ecpg (PostgreSQL 7.4) 3.0.0
Linux scaleo 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown

Stack trace:

#0  0x40163a40 in strcmp () from /lib/libc.so.6
#1  0x080678d2 in find_struct_member (name=0x80c0f88 "bnd_a[0].bnd_b[0]",
    str=0x80c0f97 "0]", members=0x80c1170, brace_level=0) at variable.c:37
#2  0x08067c1f in find_struct_member (name=0x80c0f88 "bnd_a[0].bnd_b[0]",
    str=0x80c0f91 "bnd_b[0]", members=0x80c11a0, brace_level=0) at
variable.c:110
#3  0x08067ea6 in find_struct (name=0x80c0f88 "bnd_a[0].bnd_b[0]",
    next=0x80c0f8d "[0].bnd_b[0]", end=0x80c0f90 ".bnd_b[0]") at
variable.c:185
#4  0x08067fb3 in find_variable (name=0x80c0f88 "bnd_a[0].bnd_b[0]")
    at variable.c:238
#5  0x080604c0 in yyparse () at preproc.y:6152
#6  0x08066632 in main (argc=4, argv=0xbffff284) at ecpg.c:394
#7  0x401089ed in __libc_start_main () from /lib/libc.so.6

Are nested structures not supported by ecpg ?

Thanks for any information,

Jürgen




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ecpg with nested structure
@ 2004-01-27 17:47  Michael Meskes <meskes@postgresql.org>
  parent: Jürgen Cappel <email@juergen-cappel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 2004-01-27 17:47 UTC (permalink / raw)
  To: Jürgen Cappel <email@juergen-cappel.de>; +Cc: pgsql-interfaces

On Sat, Dec 27, 2003 at 08:36:44AM +0100, Jürgen Cappel wrote:
> while porting an application from CA/Ingres to PostgreSQL
> I came across a segmentation fault by ecpg. The code looks
> something like this:
> ...
> Are nested structures not supported by ecpg ?

Well, I thought they were, but I found that there were to bugs
preventing it. As soon as I'm connected again, I will commit the patch.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-01-27 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-27 07:36 ecpg with nested structure Jürgen Cappel <email@juergen-cappel.de>
2004-01-27 17:47 ` Michael Meskes <meskes@postgresql.org>

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