Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 9CE1D1337C24 for ; Fri, 8 Apr 2011 11:43:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 56494-04-3 for ; Fri, 8 Apr 2011 14:43:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id F40E51337C66 for ; Fri, 8 Apr 2011 11:42:55 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p38EgnJ2011486; Fri, 8 Apr 2011 10:42:50 -0400 (EDT) To: Gavin Flower cc: Gavin Flower , pgsql-bugs@postgresql.org Subject: Re: BUG #5968: DOCUMENTATION: SELECT synopsis omits RETURNING keyword In-reply-to: <4D9ED595.3030108@archidevsys.co.nz> References: <201104072349.p37Nn7GX074930@wwwmaster.postgresql.org> <18884.1302231444@sss.pgh.pa.us> <4D9ED3C1.6030103@archidevsys.co.nz> <4D9ED595.3030108@archidevsys.co.nz> Comments: In-reply-to Gavin Flower message dated "Fri, 08 Apr 2011 21:29:57 +1200" Date: Fri, 08 Apr 2011 10:42:49 -0400 Message-ID: <11485.1302273769@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/45 X-Sequence-Number: 29964 Gavin Flower writes: > I found were RETURNING is defined, so I was confused... > ... > However, may be it would still be good to mention it on the SELECT page? It is mentioned --- the subsection on the WITH clause points out that you typically want to use RETURNING on an INSERT/UPDATE/DELETE in WITH. I thought about providing an example, but couldn't come up with one that was both simple and compelling. There's no strong reason to do WITH (something RETURNING) SELECT ... --- you might as well just do the work in a straight "something RETURNING" statement. To do something that actually requires the more complex syntax, you'd need to join the RETURNING result to another table or another RETURNING result. Creating an easily understandable example that involves that is beyond my powers at this time of the morning. regards, tom lane