Re: ECPG support for struct in INTO list - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: ECPG support for struct in INTO list
Date
Msg-id 20090805092417.GB27331@feivel.credativ.lan
Whole thread Raw
In response to Re: ECPG support for struct in INTO list  (Boszormenyi Zoltan <zb@cybertec.at>)
Responses Re: ECPG support for struct in INTO list  (Boszormenyi Zoltan <zb@cybertec.at>)
Re: ECPG support for struct in INTO list  (Boszormenyi Zoltan <zb@cybertec.at>)
List pgsql-hackers
On Wed, Aug 05, 2009 at 11:08:26AM +0200, Boszormenyi Zoltan wrote:
> I have looked at it. The code seems to be invalid.

Yes, it is, I was too lazy to make it valid. If you just allocate the memory
for the variable in get_var() it becomes valid.

> I tried to compile your code (with my previous "fix"
> in place, so at least :myvar is processed and C code is output):

Yes, but incorrect one.

> Some systems (stack-protector extensions to GCC, etc)
> make the code segfault immediately as soon as the first
> FETCH statement tries to touch the lost memory area.
> Just because ECPG does some tricks with ECPG_informix_set_var()
> and ECPG_informix_get_var() converting variable reference
> to runtime pointer values, the code wouldn't get magically valid.

Again, this doesn't matter in this case as we try to get the preprocessor to
work with a test case as small as possible.

> I did and I don't understand. I think it's just a bug
> in ESQL/C to accept such constructs.

I do not like this "feature" either, but it's there and therefore should work
in our compatibility mode. And it does with non-struct variables. Just look at
test/compat_informix/test_informix.pgc for a real and working example.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo/Skype: michaelmeskes, Jabber: meskes@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!


pgsql-hackers by date:

Previous
From: Boszormenyi Zoltan
Date:
Subject: Re: ECPG support for struct in INTO list
Next
From: Magnus Hagander
Date:
Subject: Re: 8.4 win32 shared memory patch