Re: [PATCHES] EXECUTE command tag returns actual command

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kris Jurka <books(at)ejurka(dot)com>, pgsql-patches(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [PATCHES] EXECUTE command tag returns actual command
Date: 2004-04-22 04:17:36
Message-ID: 200404220417.i3M4HaL24681@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Your patch has been added to the PostgreSQL unapplied patches list at:
>
> > Kris Jurka wrote:
> >> This patch makes the EXECUTE command's completion tag return the
> >> completion tag of the actual statement executed.
>
> While I don't have any strong reason to object to this, the reason
> Kris wanted it was to help let the JDBC driver use "EXECUTE prepared-stmt"
> as its basic mechanism for executing pre-prepared statements --- and
> there are a couple reasons why he should abandon that idea in favor of
> using V3-protocol Bind/Execute messages.
>
> If he goes over to using Bind/Execute then the JDBC driver will have no
> need for this patch. In that case we ought to stop and think whether
> sticking to the existing behavior isn't the right thing to do; it wins
> on backwards-compatibility grounds and we have no other use-cases saying
> we should change.
>
> Not a big complaint, but something to consider before applying.
>
> regards, tom lane
>
> PS: If you do apply, the EXECUTE reference page needs to have an
> "Output" section added explaining that it returns a tag other than the
> default "EXECUTE".

Nice:

test=> CREATE TABLE test(x int);
CREATE TABLE
test=> PREPARE x(int) AS INSERT INTO test VALUES ($1);
PREPARE
test=> EXECUTE x(3);
INSERT 17210 1

I have applied the attached patch that updates the EXECUTE docs to
mention the tag will match the PREPARE. Shame it is only available
after execute. If it could be known before, I could allow log_statement
to trigger printing depending on the type of tag.

I have also updated the log_statement docs to more clearly explain that
log_statement doesn't properly know what type of command is being
execute. log_statement does handle PREPARE properly though.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 2.5 KB

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Lars Gustafsson 2004-04-22 10:45:41 unsubscribe revisited
Previous Message Bruce Momjian 2004-04-22 02:53:58 Re: [JDBC] EXECUTE command tag returns actual command

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2004-04-22 05:15:02 Re: PSQLRC environment variable.
Previous Message Bruce Momjian 2004-04-22 03:50:58 Re: Fix for socket error msgs on win32