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-07-17 13:58:21 |
Message-ID: | 4A60837D.1080908@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Michael Meskes írta:
> On Fri, Jul 17, 2009 at 12:27:49PM +0200, Boszormenyi Zoltan wrote:
>
>> one of our clients wants to port their application suite
>> from Informix to PostgreSQL, they use constructs like
>>
>> SELECT * INTO :tablerec FROM table ...
>>
>> where "tablerec" mirrors the table fields in a C struct.
>>
>
> Well, this was supposed to work.
>
>
>> Currently ECPG dumps core on this, more exactly aborts on it
>> in ecpg_type_name().
>>
>
> Could you please send an example where it dumps core?
>
Attached is the short example I can reproduce with.
The version I used was final PostgreSQL 8.4.0, without our
extensions posted already. I added an indication to ecpg_type_name():
[zozo(at)db00 ecpg-test]$ ecpg -C INFORMIX test28.pgc
ecpg_type_name: unhandled type 22
Félbeszakítva (core dumped)
Type 22 is exactly ECPGt_struct. gdb cannot get the passed value:
[zozo(at)db00 ecpg-test]$ gdb ~/pgc84pre/bin/ecpg core.850
...
#0 0x0000003994032215 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
#0 0x0000003994032215 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x0000003994033d83 in abort () at abort.c:88
#2 0x0000000000423d65 in ecpg_type_name (typ=<value optimized out>) at
typename.c:65
#3 0x0000000000402742 in adjust_informix (list=0x1e74560) at preproc.y:272
#4 0x0000000000406ca7 in base_yyparse () at preproc.y:6581
#5 0x0000000000422b22 in main (argc=4, argv=0x7fff24b40aa8) at ecpg.c:456
test28.pgc contains this, ECPG aborts:
EXEC SQL DECLARE mycur CURSOR FOR SELECT * INTO :myvar FROM a1 WHERE id = 1;
EXEC SQL FETCH FROM mycur;
But you are right about the "supposed to work" part,
if I modify it the way below, it works:
EXEC SQL DECLARE mycur CURSOR FOR SELECT * FROM a1 WHERE id = 1;
EXEC SQL FETCH FROM mycur INTO :myvar;
Thanks,
Zoltán Böszörményi
> Michael
>
--
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.h | text/x-chdr | 108 bytes |
test28.pgc | text/plain | 860 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2009-07-17 14:34:09 | Re: slow count in window query |
Previous Message | Fujii Masao | 2009-07-17 13:58:07 | Re: Review: support for multiplexing SIGUSR1 |