Re: [PATCHES] EXECUTE command tag returns actual command

Lists: pgsql-jdbcpgsql-patches
From: Kris Jurka <books(at)ejurka(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: EXECUTE command tag returns actual command
Date: 2004-04-18 10:03:06
Message-ID: Pine.BSO.4.56.0404180458290.31686@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches


This patch makes the EXECUTE command's completion tag return the
completion tag of the actual statement executed. This allows the
correct update count to be returned for UPDATE/INSERT/DELETE
statements. Per discussion on hackers here:

http://archives.postgresql.org/pgsql-hackers/2004-03/msg00923.php

Kris Jurka

Attachment Content-Type Size
executetag.patch text/plain 2.9 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: EXECUTE command tag returns actual command
Date: 2004-04-20 00:58:49
Message-ID: 200404200058.i3K0wnb10090@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Kris Jurka wrote:
>
> This patch makes the EXECUTE command's completion tag return the
> completion tag of the actual statement executed. This allows the
> correct update count to be returned for UPDATE/INSERT/DELETE
> statements. Per discussion on hackers here:
>
> http://archives.postgresql.org/pgsql-hackers/2004-03/msg00923.php
>
> Kris Jurka

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
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


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(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: EXECUTE command tag returns actual command
Date: 2004-04-20 04:15:05
Message-ID: 3739.1082434505@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches

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".


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] EXECUTE command tag returns actual command
Date: 2004-04-22 02:53:58
Message-ID: 200404220253.i3M2rwE08999@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches


Patch applied. Thanks.

---------------------------------------------------------------------------

Kris Jurka wrote:
>
> This patch makes the EXECUTE command's completion tag return the
> completion tag of the actual statement executed. This allows the
> correct update count to be returned for UPDATE/INSERT/DELETE
> statements. Per discussion on hackers here:
>
> http://archives.postgresql.org/pgsql-hackers/2004-03/msg00923.php
>
> Kris Jurka

Content-Description:

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

--
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


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
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