Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 08BB1133798E for ; Fri, 8 Apr 2011 06:32:38 -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 30479-06 for ; Fri, 8 Apr 2011 09:32:17 +0000 (UTC) X-Greylist: from auto-whitelisted 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 D99241336FA7 for ; Fri, 8 Apr 2011 06:32:16 -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 p389MJkf017295 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 8 Apr 2011 21:22:20 +1200 Message-ID: <4D9ED3C1.6030103@archidevsys.co.nz> Date: Fri, 08 Apr 2011 21:22:09 +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> In-Reply-To: <18884.1302231444@sss.pgh.pa.us> Content-Type: multipart/alternative; boundary="------------010201070408060906000502" 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/43 X-Sequence-Number: 29962 This is a multi-part message in MIME format. --------------010201070408060906000502 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------010201070408060906000502 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------010201070408060906000502--