Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-jdbcpgsql-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

In response to

pgsql-patches by date

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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group