From: | Boszormenyi Zoltan <zb(at)cybertec(dot)at> |
---|---|
To: | Michael Meskes <meskes(at)postgresql(dot)org> |
Cc: | 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 14:22:53 |
Message-ID: | 4A7995BD.3090703@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Michael Meskes írta:
> 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.
>
If you meant like this below, then ECPG segfaults on this too:
int *
get_var(void)
{
EXEC SQL BEGIN DECLARE SECTION;
int *myvar;
EXEC SQL END DECLARE SECTION;
myvar = malloc(sizeof(int));
EXEC SQL DECLARE mycur CURSOR FOR SELECT id INTO :myvar FROM a1
WHERE id = 1;
return myvar;
}
ecpg_type_name() aborts, ECPGt_array is unhandled
besides struct and union, it's called at the same place
in adjust_informix() as ECPGt_struct.
Attached is my modified test28.pgc. Compiling it
*without* -C INFORMIX makes it unusable, the variable
or the address where the data should be fetched into
doesn't even gets emitted in neither the DECLARE/OPEN
nor the FETCH callsites. I think this code should be valid
even in non-Informix-compatible mode.
> ... Just look at
> test/compat_informix/test_informix.pgc for a real and working example.
>
The example there is the other way around.
The variable, the DECLARE and FETCH commands
are in the outer main() function, and it calls a function called
openit() where the OPEN command is emitted, so that
example doesn't help here too much.
Best regards,
Zoltán Böszörményi
--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/
Attachment | Content-Type | Size |
---|---|---|
test28.pgc | text/plain | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Boszormenyi Zoltan | 2009-08-05 14:28:11 | Re: ECPG support for struct in INTO list |
Previous Message | Tom Lane | 2009-08-05 14:17:13 | Re: machine-readable explain output v4 |