Skip site navigation (1) Skip section navigation (2)

Re: BUG #5968: DOCUMENTATION: SELECT synopsis omits RETURNING keyword

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gavin Flower <gavin(dot)flower(at)archidevsys(dot)co(dot)nz>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5968: DOCUMENTATION: SELECT synopsis omits RETURNING keyword
Date: 2011-04-08 09:29:57
Message-ID: 4D9ED595.3030108@archidevsys.co.nz (view raw or flat)
Thread:
Lists: pgsql-bugs
On 08/04/11 21:22, Gavin Flower wrote:
> On 08/04/11 14:57, Tom Lane wrote:
>> "Gavin Flower"<gavin(dot)flower(at)archidevsys(dot)co(dot)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!)

In response to

Responses

pgsql-bugs by date

Next:From: ShianmiinDate: 2011-04-08 12:43:07
Subject: Re: PostgreSQL backend process high memory usage issue
Previous:From: Gavin FlowerDate: 2011-04-08 09:22:09
Subject: Re: BUG #5968: DOCUMENTATION: SELECT synopsis omits RETURNING keyword

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group