Re: [PATCH] Provide rowcount for utility SELECTs

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: Re: [PATCH] Provide rowcount for utility SELECTs
Date: 2009-12-29 07:58:14
Message-ID: 4B39B696.8080704@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane írta:
> Boszormenyi Zoltan <zb(at)cybertec(dot)at> writes:
>
>> attached is a small patch that makes it possible for clients
>> to receive row count for SELECT ... INTO ... and CREATE TABLE ... AS ...
>>
>
>
>> Comments?
>>
>
> This doesn't look tremendously well thought out to me.
>
> 1. As given, the patch changes the result not only for SELECT INTO but
> for any SELECT executed in PORTAL_MULTI_QUERY context (consider SELECTs
> added by rules for example). It seems like a pretty bad idea for the
> result of a statement to depend on context.
>
> 2. In the past we have regretted it when we made the same command tag
> sometimes have numbers attached and sometimes not (note the hack at
> the bottom of PortalRunMulti). It doesn't seem like terribly good
> design to do that here. On the other hand, always attaching a count
> to SELECT tags would greatly increase the risk of breaking clients.
>

Okay, how about introducing a new "SELECTINTO N" command tag, then?
It's also a protocol change, but at least it can fall into the very last
"else"
anywhere, hence have a high chance of being ignored and handled the same
way as other not rowcount-returning tags.

> I'm not at all convinced that this is so useful as to justify taking
> any compatibility risks for. People who really need that count can
> get it easily enough by breaking the command into a CREATE followed
> by INSERT/SELECT.
>

Yes, and every WITH RECURSIVE statement can also be broken up
manually as well. It's simply shorter and has a chance of being a little
more resource-effective:
- one parsing/planning phase instead of two on the server side
- one error checking in the app instead of two
- PostgreSQL already has the infrastructure to return the rowcount

Best regards,
Zoltán Böszörményi

--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-12-29 08:06:21 Re: [PATCH] Provide rowcount for utility SELECTs
Previous Message Boszormenyi Zoltan 2009-12-29 07:50:49 Re: [PATCH] Provide rowcount for utility SELECTs