On Sat, Feb 13, 2010 at 10:15 PM, Bruce Momjian <bruce@momjian.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