From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Boszormenyi Zoltan <zb(at)cybertec(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] Provide rowcount for utility SELECTs |
Date: | 2010-02-14 03:30:24 |
Message-ID: | 603c8f071002131930s24d7864fs2e38bb35e8b5bab5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Feb 13, 2010 at 10:15 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Boszormenyi Zoltan wrote:
>> >>> Ah, I didn't even see that that section needed to be updated. Good
>> >>> catch. I'd suggest the following wording:
>> >>>
>> >>> For a <command>SELECT</command> or <command>CREATE TABLE AS</command>
>> >>> command, the tag is SELECT rows... [and the rest as you have it]
>> >>>
>> >>> We should probably also retitle that section from "Retrieving Result
>> >>> Information for Other Commands" to "Retrieving Other Result
>> >>> Information" and adjust the text of the opening sentence similarly.
>> >>>
>> >>> Also I think you need to update the docs for PQcmdtuples to mention
>> >>> that it not works for SELECT and CTAS.
>> >>>
>> >>>
>> >> Ok, I will update libpq.sgml where this section resides.
>> >> What's a CTA, btw? Do you mean CTE, a.k.a. "Common Table Expression"?
>> >>
>> >
>> > Sorry, CTAS = CREATE TABLE AS SELECT.
>> >
>>
>> Okay, new patch is attached. Please read the docs changes, and comment.
>
> I have reviewed this patch and made some adjustments, attached. The
> major change is that our return of "0 0" in certain cases must remain,
> though I have improved the C comment explaining it with a separate CVS
> commit:
>
> /*
> * If a command completion tag was supplied, use it. Otherwise use the
> * portal's commandTag as the default completion tag.
> *
> * Exception: Clients expect INSERT/UPDATE/DELETE tags to have
> * counts, so fake them with zeros. This can happen with DO INSTEAD
> * rules if there is no replacement query of the same type as the
> * original. We print "0 0" here because technically there is no
> * query of the matching tag type, and printing a non-zero count for
> * a different query type seems wrong, e.g. an INSERT that does
> * an UPDATE instead should not print "0 1" if one row
> * was updated. See QueryRewrite(), step 3, for details.
> */
>
> I have removed the part of the patch that chagned "0 0"; it seems to
> run fine without it. The rest of my adjustments were minor.
>
> One major part of the patch seems to be the collection of the
> PORTAL_ONE_SELECT switch label into the label below it, which is a nice
> cleanup.
Thanks for taking the time to review this. I think your adjustments are good.
...Robert
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-02-14 03:40:23 | Re: knngist patch support |
Previous Message | Robert Haas | 2010-02-14 03:26:55 | Re: knngist patch support |