From: | Boszormenyi Zoltan <zb(at)cybertec(dot)at> |
---|---|
To: | Boszormenyi Zoltan <zb(at)cybertec(dot)at>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at> |
Subject: | Re: DECLARE doesn't set/reset sqlca after DECLARE cursor |
Date: | 2009-08-13 15:55:53 |
Message-ID: | 4A843789.2050202@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Michael Meskes írta:
> On Wed, Aug 12, 2009 at 07:13:44PM +0200, Boszormenyi Zoltan wrote:
>
>> a customer of us complained a behavioural difference
>> ...
>> The attached patch implements this. The only downside
>> is that now DECLARE CURSOR cannot appear outside
>> of a function, a change in test/preproc/variable.pgc reflects
>>
>
> DECLARE by definition is a declarative command and as such should be able to
> live outside a function.
>
Okay, so it's a declarative command. But if we're in a function,
we should still emit a call to ecpg_init, to be able to follow
the Informix behaviour. We can limit it it compat mode, though.
The attached patch does this, and detects being inside of a function
by braces_open > 0. Short of rewriting ECPG into a flull-fledged
C/C++ preprocessor, we can't do better currently.
In compat mode, you cannot do
DECLARE mycur CURSOR FOR SELECT ... INTO :var, ...
or
DECLARE mycur CURSOR FOR SELECT ... WHERE field = ?
in the global scope because adjust_informix() emits function calls
outside of a function. Or is this declaration illegal?
At least it should be documented in PostgreSQL.
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-declare-reset-sqlca-2-ctxdiff.patch | text/x-patch | 8.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Hitoshi Harada | 2009-08-13 16:07:58 | Re: Implementation of GROUPING SETS (T431: Extended grouping capabilities) |
Previous Message | Kevin Grittner | 2009-08-13 15:29:09 | Re: Hot standby and synchronous replication status |