public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: David G. Johnston <[email protected]>
Cc: [email protected]
Cc: Pg Docs <[email protected]>
Subject: Re: Mention RETURNING ... INTO target
Date: Tue, 07 Jun 2022 17:07:30 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAKFQuwa6JQ9kBTOnCALcPOSqvAr7_xtT00ox5KD98n-AXn+7pA@mail.gmail.com>
References: <[email protected]>
	<CAKFQuwa6JQ9kBTOnCALcPOSqvAr7_xtT00ox5KD98n-AXn+7pA@mail.gmail.com>

"David G. Johnston" <[email protected]> writes:
> On Tue, Jun 7, 2022 at 1:30 PM PG Doc comments form <[email protected]>
> wrote:
>> It looks like INSERT INTO ... RETURNING allows defining a target for the
>> returned values like SELECT ... INTO does.

> That isn't how it works.  RETURNING simply turns INSERT into a result set
> producing SQL Command.  And SQL doesn't have a concept of "target"
> (variables) in the sense you are thinking. pg/pgsql does, allowing result
> set data to be placed into variables.

Right.  And in fact this *is* documented in the context of pl/pgsql:

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

			regards, tom lane





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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Mention RETURNING ... INTO target
  In-Reply-To: <[email protected]>

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

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