Re: ECPG support for struct in INTO list

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: Re: ECPG support for struct in INTO list
Date: 2009-08-05 09:24:17
Message-ID: 20090805092417.GB27331@feivel.credativ.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)jabber(dot)org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2009-08-05 09:31:03 Re: 8.4 win32 shared memory patch
Previous Message Boszormenyi Zoltan 2009-08-05 09:08:26 Re: ECPG support for struct in INTO list