ECPG support for struct in INTO list

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: ECPG support for struct in INTO list
Date: 2009-07-17 10:27:49
Message-ID: 4A605225.4050205@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

Currently ECPG dumps core on this, more exactly aborts on it
in ecpg_type_name().

Patch is attached that solves it by introducing add_struct_to_head()
called from rule "coutputvariable" that also catches C unions now,
emitting an error because unions cannot be unambiguously unrolled.
It tries to handle NULL indicator, expecting a struct with at least
the same amount of members.

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
pg85-5-struct.patch text/x-patch 5.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2009-07-17 10:28:37 Re: [PATCH] DefaultACLs
Previous Message Nikhil Sontakke 2009-07-17 09:54:55 Re: GRANT ON ALL IN schema