fix for parameterized queries in DECLARE CURSOR statements

Started by Oliver Jowettabout 22 years ago2 messagespatches
Jump to latest
#1Oliver Jowett
oliver@opencloud.com

Here's a patch that allows parameterized queries to be used in a DECLARE
CURSOR statement.

Previously, the DECLARE would succeed but any FETCHes would fail as the
parameter values supplied to DECLARE were not propagated to the portal
it created. This patch adds that propagation. See
http://archives.postgresql.org/pgsql-hackers/2004-07/msg01047.php for
discussion.

I've tested the V3 protocol and SQL function paths by hand. The SPI path
hasn't been specifically tested but the regression tests appear happy.

-O

Attachments:

pgsql-server-parameterized-declare.txttext/plain; name=pgsql-server-parameterized-declare.txtDownload+209-45
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Oliver Jowett (#1)
Re: fix for parameterized queries in DECLARE CURSOR statements

Oliver Jowett <oliver@opencloud.com> writes:

Here's a patch that allows parameterized queries to be used in a DECLARE
CURSOR statement.

Applied with minor editorialization. I found a couple of places where
you'd missed inserting type Oids into constructed ParamLists, and I took
advantage of the extra info to add Asserts checking that the value found
in a ParamList is in fact what the caller expects.

regards, tom lane