From "Tom Lane" <[email protected]>
To "David G. Johnston" <[email protected]>
Cc [email protected]; "Pg Docs" <[email protected]>
Date 07.06.2022 23:07:30
Subject Re: Mention RETURNING ... INTO target

"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

Thanks for the pointer to the documentation. I did not think to look for
"single-row results" when looking for an assumed option of "INSERT".

s.

Reply via email to