Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 76CF11337B6E for ; Fri, 8 Apr 2011 06:30:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 50242-03 for ; Fri, 8 Apr 2011 09:30:11 +0000 (UTC) X-Greylist: delayed 00:07:45.390521 by SQLgrey-1.7.6 Received: from mbx.knossos.net.nz (mbx.knossos.net.nz [202.160.48.10]) by mail.postgresql.org (Postfix) with ESMTP id 3C381133798E for ; Fri, 8 Apr 2011 06:30:09 -0300 (ADT) Received: from [10.1.1.3] (60-234-150-59.bitstream.orcon.net.nz [60.234.150.59]) (authenticated bits=0) by mbx.knossos.net.nz (8.14.4/8.14.4) with ESMTP id p389U8Uu017371 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 8 Apr 2011 21:30:08 +1200 Message-ID: <4D9ED595.3030108@archidevsys.co.nz> Date: Fri, 08 Apr 2011 21:29:57 +1200 From: Gavin Flower Organization: ArchiDevSys User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 MIME-Version: 1.0 To: Tom Lane CC: Gavin Flower , pgsql-bugs@postgresql.org Subject: Re: BUG #5968: DOCUMENTATION: SELECT synopsis omits RETURNING keyword References: <201104072349.p37Nn7GX074930@wwwmaster.postgresql.org> <18884.1302231444@sss.pgh.pa.us> <4D9ED3C1.6030103@archidevsys.co.nz> In-Reply-To: <4D9ED3C1.6030103@archidevsys.co.nz> Content-Type: multipart/alternative; boundary="------------060100010701080101050204" X-Virus-Scanned: clamav-milter 0.97 at mbx.knossos.net.nz X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201104/42 X-Sequence-Number: 29961 This is a multi-part message in MIME format. --------------060100010701080101050204 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 08/04/11 21:22, Gavin Flower wrote: > On 08/04/11 14:57, Tom Lane wrote: >> "Gavin Flower" writes: >>> I think the documentation of SELECT should include the keyword 'RETURNING' >>> in its synopsis. >> Huh? There's no SELECT RETURNING. >> >> regards, tom lane > The 'WITH' clause is described in the synopsis for 'SELECT' - and the > 'WITH' clause uses the keyword 'RETURNING'. > > and/with_query/ is: > > /with_query_name/ [ (/column_name/ [, ...] ) ] AS (/select/ |/insert/ |/update/ |/delete/ ) > > So as the 'WITH' clause is defined in the synopsis, I would expect > that the synopsis for 'SELECT' should also mention the 'RETURNING' > keyword - but it does not. > > There is an example in: > '7.8. WITH Queries (Common Table Expressions)' > WITH t AS ( > UPDATE products SET price = price * 1.05 > RETURNING * > ) > SELECT * FROM t; > > Regards, > Gavin I found were RETURNING is defined, so I was confused... Synopsis UPDATE [ ONLY ]/table/ [ [ AS ]/alias/ ] SET {/column/ = {/expression/ | DEFAULT } | (/column/ [, ...] ) = ( {/expression/ | DEFAULT } [, ...] ) } [, ...] [ FROM/fromlist/ ] [ WHERE/condition/ | WHERE CURRENT OF/cursor_name/ ] [ RETURNING * |/output_expression/ [ [ AS ]/output_name/ ] [, ...] ] However, may be it would still be good to mention it on the SELECT page? Cheers, Gavin (Who while feeling a little foolish, still thinks he has a valid point!) --------------060100010701080101050204 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/04/11 21:22, Gavin Flower wrote:
On 08/04/11 14:57, Tom Lane wrote:
"Gavin Flower" <gavin.flower@archidevsys.co.nz> writes:
I think the documentation of SELECT should include the keyword 'RETURNING'
in its synopsis.
Huh?  There's no SELECT RETURNING.

			regards, tom lane
The 'WITH' clause is described in the synopsis for 'SELECT' - and the 'WITH' clause uses the keyword 'RETURNING'. 

and with_query is:

    with_query_name [ ( column_name [, ...] ) ] AS ( select | insert | update | delete )

So as the 'WITH' clause is defined in the synopsis, I would expect that the synopsis for 'SELECT' should also mention the 'RETURNING' keyword - but it does not.

There is an example in:
'7.8. WITH Queries (Common Table Expressions)'
WITH t AS (
    UPDATE products SET price = price * 1.05
    RETURNING *
)
SELECT * FROM t;

Regards,
Gavin

I found were RETURNING is defined, so I was confused...

Synopsis

UPDATE [ ONLY ] table [ [ AS ] alias ]
    SET { column = { expression | DEFAULT } |
          ( column [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
    [ FROM fromlist ]
    [ WHERE condition | WHERE CURRENT OF cursor_name ]
    [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]

However, may be it would still be good to mention it on the SELECT page?


Cheers,
Gavin

(Who while feeling a little foolish, still thinks he has a valid point!)

--------------060100010701080101050204--