Lists: | pgsql-hackers |
---|
From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | execute command tag including affected rows count |
Date: | 2004-03-21 16:39:23 |
Message-ID: | Pine.BSO.4.56.0403211119010.113@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Would it be possible to have the command completion tag for EXECUTE return
the affected row count? The JDBC API says you should be able to get the
affected row count for any statement and I'm working on integrating a
patch that transforms regular statements to server side prepared
statements, and I'm stuck on this issue.
CREATE TABLE t (a int);
INSERT INTO t VALUES (1);
INSERT INTO t VALUES (2);
PREPARE mystatement AS DELETE FROM t;
EXECUTE mystatement;
would ideally return "EXECUTE 2"
Kris Jurka
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Kris Jurka <books(at)ejurka(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: execute command tag including affected rows count |
Date: | 2004-03-21 21:07:28 |
Message-ID: | C2DF8081-7B7B-11D8-ADA2-000A95AB279E@samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 21-Mar-04, at 11:39 AM, Kris Jurka wrote:
> Would it be possible to have the command completion tag for EXECUTE
> return
> the affected row count?
Yes, this has been suggested before -- for example:
http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg26787.html
I agree it would be a good idea, although I can't recall what the
conclusion of the previous discussions was -- did anyone raise any
critical objections to this?
-Neil
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | Kris Jurka <books(at)ejurka(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: execute command tag including affected rows count |
Date: | 2004-03-21 23:05:54 |
Message-ID: | 7917.1079910354@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Neil Conway <neilc(at)samurai(dot)com> writes:
> On 21-Mar-04, at 11:39 AM, Kris Jurka wrote:
>> Would it be possible to have the command completion tag for EXECUTE
>> return
>> the affected row count?
> Yes, this has been suggested before -- for example:
> http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg26787.html
> I agree it would be a good idea, although I can't recall what the
> conclusion of the previous discussions was -- did anyone raise any
> critical objections to this?
The previous discussion concluded that EXECUTE should return the command
tag of the executed command --- eg, "UPDATE n" not "EXECUTE n". Without
this, you cannot for example sensibly cope with both the INSERT and
UPDATE tag formats.
Not sure what it takes internally to the backend to make this happen
... but IIRC there already is provision for utility commands to override
their default tag, so I hope that it would be a pretty localized change.
However, does this really solve Kris' problem? JDBC generally likes to
think that it works with old Postgres versions; will a fix that only
works in >= 7.5 be good enough for them?
regards, tom lane
From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Neil Conway <neilc(at)samurai(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: execute command tag including affected rows count |
Date: | 2004-03-22 01:55:17 |
Message-ID: | Pine.BSO.4.56.0403212042080.342@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sun, 21 Mar 2004, Tom Lane wrote:
> > On 21-Mar-04, at 11:39 AM, Kris Jurka wrote:
> >> Would it be possible to have the command completion tag for EXECUTE
> >> return
> >> the affected row count?
>
> However, does this really solve Kris' problem? JDBC generally likes to
> think that it works with old Postgres versions; will a fix that only
> works in >= 7.5 be good enough for them?
>
I oversimplified the description of the current patch I'm working on,
server side prepared statement support has been in the driver since the
7.3 days. So this problem already exists and has simply been unnoticed.
With the current code it is difficult to enable server prepared statements
and requires writing pg specific code outside of the standard JDBC API.
The patch I'm reviewing makes it simple to turn on server prepared
statements globally and brought this bug to my attention. I would say
"better late than never."
Kris Jurka
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | Kris Jurka <books(at)ejurka(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: execute command tag including affected rows count |
Date: | 2004-03-22 03:33:53 |
Message-ID: | 200403220333.i2M3XrA00390@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Neil Conway wrote:
> On 21-Mar-04, at 11:39 AM, Kris Jurka wrote:
> > Would it be possible to have the command completion tag for EXECUTE
> > return
> > the affected row count?
>
> Yes, this has been suggested before -- for example:
>
> http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg26787.html
>
> I agree it would be a good idea, although I can't recall what the
> conclusion of the previous discussions was -- did anyone raise any
> critical objections to this?
Should this be a TODO?
--
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