pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [JDBC] V3 protocol + DECLARE problems
Date: Fri, 23 Jul 2004 16:15:19 +1200
Message-ID: <410090D7.7030900@opencloud.com> (raw)
In-Reply-To: <9813.1090509192@sss.pgh.pa.us>
References: <40FD982D.2080006@opencloud.com>
	<9141.1090424549@sss.pgh.pa.us>
	<40FFA5C0.7050701@opencloud.com>
	<9813.1090509192@sss.pgh.pa.us>

Tom Lane wrote:

> Hm.  The copying bit bothers me, and I guess after some thought it's
> a semantic issue.  If you've got
> 
> 	DECLARE c CURSOR FOR SELECT ... WHERE foo = $1;
> 
> 	FETCH 10 FROM c;
> 
> it's not very clear when the value of $1 should be supplied.  With your
> proposal the parameter value would have to be supplied in the Bind
> message for the DECLARE CURSOR command.  That may be the only way to do
> it (certainly I'd not want several successive FETCHes to use different
> parameter values), but it still seems a bit weird.

It doesn't seem too weird, we're using Parse/Bind to separate the query 
template from concrete parameter values. When the Bind is done, we want 
to behave as if executing the DECLARE with actual parameter values 
substituted into the query string originally -- that matches the 
behaviour of Bind for other queries. So using the parameters to DECLARE 
for the constructed portal seems right.

If we were to do it any other way, we'd have to special-case Parse or 
Bind for DECLARE to expect some different (zero?) number of parameters 
in the Bind. exec_bind_message does a check quite early on that the 
number of parameters provided matches the number expected.

> BTW, rather than hacking the parameter list of ProcessUtility,
> I'd be inclined to just look at ActivePortal->portalParams in
> PerformCursorOpen.  (Come to think of it, we could also copy
> ActivePortal's sourceText at the PortalDefineQuery step.)

Ok, I'll do that.

-O



view thread (10+ messages)  latest in thread

Message-ID: <410090D7.7030900@opencloud.com>
Permalink:  ../410090D7.7030900@opencloud.com/
Also on:    postgresql.org/message-id/410090D7.7030900@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
  Subject: Re: [JDBC] V3 protocol + DECLARE problems
  In-Reply-To: <410090D7.7030900@opencloud.com>
  References: <40FD982D.2080006@opencloud.com> <9141.1090424549@sss.pgh.pa.us> <40FFA5C0.7050701@opencloud.com> <9813.1090509192@sss.pgh.pa.us> <410090D7.7030900@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox