Re: ECPG Segfault and variable usage question.

Lists: pgsql-interfaces
From: Jürgen Cappel <email(at)juergen-cappel(dot)de>
To: "pgsql-interfaces" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: ECPG Segfault and variable usage question.
Date: 2004-02-17 20:15:20
Message-ID: JEEKIPNAKJNCFLMOBKHGGEEIDCAA.email@juergen-cappel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Hello Michael,

some more info: the segmentation fault still occurs under Linux (SuSE 8.0)
with today's snapshot. No options used, just the filename as the only arg.
I tried it on Solaris 8 today where it compiles fine. It works on Linux
when I change the variable name from "var" to "myvar" or add a variable in
the DECLARE section, but that can't be the solution. Any idea on how to
find the problem ?

Oh, BTW: the expression :myarray[index[10]] compiles OK as of
pgc.l version 1.125 2004/02/15 Thanks for your help !

Jürgen

-----Ursprüngliche Nachricht-----
Von: pgsql-interfaces-owner(at)postgresql(dot)org
[mailto:pgsql-interfaces-owner(at)postgresql(dot)org]Im Auftrag von Michael
Meskes
Gesendet: Sonntag, 15. Februar 2004 14:42
An: Jürgen Cappel
Cc: pgsql-interfaces
Betreff: Re: [INTERFACES] ECPG Segfault and variable usage question.

On Thu, Feb 12, 2004 at 08:00:12PM +0100, Jürgen Cappel wrote:
> this is a code snippet that causes ECPG to segfault. It's quite tricky

I took this code as a.pgc and ran 'ecpg a.pgc' without any problem. Do
you use any special options for ecpg?

> Stack trace was obtained using a snapshot from about 2 weeks ago, ECPG
from
> the 7.4.1 release segfaults also.

Hmm, my 7.4.1 version also compiles this snippet cleanly.

> 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,

Could you please try if the following patch helps you?

--- /home/postgres/pgsql-ecpg/preproc/pgc.l 2003-12-29 14:53:04.000000000
+0100
+++ pgc.l 2004-02-15 14:38:43.000000000 +0100
@@ -183,7 +183,7 @@

identifier {ident_start}{ident_cont}*

-array ({ident_cont}|{whitespace}|[\+\-\*\%\/\(\)])*
+array ({ident_cont}|{whitespace}|[\[\]\+\-\*\%\/\(\)])*
typecast "::"

/*

This will make it into CVS soon.

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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


From: Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
To: Jürgen Cappel <email(at)juergen-cappel(dot)de>
Cc: "pgsql-interfaces" <pgsql-interfaces(at)postgresql(dot)org>, Lee Kindness <lkindness(at)csl(dot)co(dot)uk>
Subject: Re: ECPG Segfault and variable usage question.
Date: 2004-02-18 16:24:42
Message-ID: 16435.37322.821148.944118@kelvin.csl.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Try running your app under Valgrind:

http://valgrind.kde.org/
http://developer.kde.org/~sewardj/valgrind-2.1.0.tar.bz2

it'll point out exactly where the seg fault is happening and
why. Remember to compile your app, and libecpg, with debugging
symbols.

L.

Jürgen Cappel writes:
> Hello Michael,
>
> some more info: the segmentation fault still occurs under Linux (SuSE 8.0)
> with today's snapshot. No options used, just the filename as the only arg.
> I tried it on Solaris 8 today where it compiles fine. It works on Linux
> when I change the variable name from "var" to "myvar" or add a variable in
> the DECLARE section, but that can't be the solution. Any idea on how to
> find the problem ?
>
> Oh, BTW: the expression :myarray[index[10]] compiles OK as of
> pgc.l version 1.125 2004/02/15 Thanks for your help !
>
> Jürgen
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: pgsql-interfaces-owner(at)postgresql(dot)org
> [mailto:pgsql-interfaces-owner(at)postgresql(dot)org]Im Auftrag von Michael
> Meskes
> Gesendet: Sonntag, 15. Februar 2004 14:42
> An: Jürgen Cappel
> Cc: pgsql-interfaces
> Betreff: Re: [INTERFACES] ECPG Segfault and variable usage question.
>
>
> On Thu, Feb 12, 2004 at 08:00:12PM +0100, Jürgen Cappel wrote:
> > this is a code snippet that causes ECPG to segfault. It's quite tricky
>
> I took this code as a.pgc and ran 'ecpg a.pgc' without any problem. Do
> you use any special options for ecpg?
>
> > Stack trace was obtained using a snapshot from about 2 weeks ago, ECPG
> from
> > the 7.4.1 release segfaults also.
>
> Hmm, my 7.4.1 version also compiles this snippet cleanly.
>
> > 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,
>
> Could you please try if the following patch helps you?
>
> --- /home/postgres/pgsql-ecpg/preproc/pgc.l 2003-12-29 14:53:04.000000000
> +0100
> +++ pgc.l 2004-02-15 14:38:43.000000000 +0100
> @@ -183,7 +183,7 @@
>
> identifier {ident_start}{ident_cont}*
>
> -array ({ident_cont}|{whitespace}|[\+\-\*\%\/\(\)])*
> +array ({ident_cont}|{whitespace}|[\[\]\+\-\*\%\/\(\)])*
> typecast "::"
>
> /*
>
> This will make it into CVS soon.
>
> Michael
> --
> Michael Meskes
> Email: Michael at Fam-Meskes dot De
> ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
> Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>


From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Jürgen Cappel <email(at)juergen-cappel(dot)de>
Cc: pgsql-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: ECPG Segfault and variable usage question.
Date: 2004-02-24 10:30:51
Message-ID: 20040224103051.GB12477@trantor.fam-meskes.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

On Tue, Feb 17, 2004 at 09:15:20PM +0100, Jürgen Cappel wrote:
> some more info: the segmentation fault still occurs under Linux (SuSE 8.0)
> with today's snapshot. No options used, just the filename as the only arg.
> I tried it on Solaris 8 today where it compiles fine. It works on Linux
> when I change the variable name from "var" to "myvar" or add a variable in
> the DECLARE section, but that can't be the solution. Any idea on how to
> find the problem ?

Run it under an malloc debugger to see where the problem arises. Or
would it be possible to give me a temporary account on that machine so I
can test myself?

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