pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: miguelgilmartinez@gmail.com
To: pgsql-docs@lists.postgresql.org
Subject: Re: SQL "RETURNING * | output_expression [ [ AS ]" is wrong
Date: Mon, 21 Mar 2022 20:12:10 +0800
Message-ID: <20220321121210.pknnj3d4k54ddprw@jrouhaud> (raw)
In-Reply-To: <164785739575.668.4514247042951418611@wrigleys.postgresql.org>
References: <164785739575.668.4514247042951418611@wrigleys.postgresql.org>

Hi,

On Mon, Mar 21, 2022 at 10:09:55AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Hi! AFAIK, UPDATE .... RETURNING works with INTO varname, not AS

I think you're confusing with plpgsql's INTO [1].  The documented syntax works
as expected:

# UPDATE tt SET id = 2 WHERE id = 1 RETURNING id AS new_id;
 new_id
--------
      2
(1 row)

[1] https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW





view thread (2+ messages)

Message-ID: <20220321121210.pknnj3d4k54ddprw@jrouhaud>
Permalink:  ../20220321121210.pknnj3d4k54ddprw@jrouhaud/
Also on:    postgresql.org/message-id/20220321121210.pknnj3d4k54ddprw@jrouhaud

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: rjuju123@gmail.com, miguelgilmartinez@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: SQL "RETURNING * | output_expression [ [ AS ]" is wrong
  In-Reply-To: <20220321121210.pknnj3d4k54ddprw@jrouhaud>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox