public inbox for [email protected]  
help / color / mirror / Atom feed
Mention RETURNING ... INTO target
4+ messages / 4 participants
[nested] [flat]

* Mention RETURNING ... INTO target
@ 2022-06-07 18:31 PG Doc comments form <[email protected]>
  2022-06-07 20:47 ` Re: Mention RETURNING ... INTO target David G. Johnston <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: PG Doc comments form @ 2022-06-07 18:31 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-insert.html
Description:

It looks like INSERT INTO ... RETURNING allows defining a target for the
returned values like SELECT ... INTO does. 

This could be mentioned in the synopsis, or at least in the description of
"output_expression", maybe even garnished with an example.

Thanks,
s.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Mention RETURNING ... INTO target
  2022-06-07 18:31 Mention RETURNING ... INTO target PG Doc comments form <[email protected]>
@ 2022-06-07 20:47 ` David G. Johnston <[email protected]>
  2022-06-07 21:07   ` Re: Mention RETURNING ... INTO target Tom Lane <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: David G. Johnston @ 2022-06-07 20:47 UTC (permalink / raw)
  To: [email protected]; Pg Docs <[email protected]>

n Tue, Jun 7, 2022 at 1:30 PM PG Doc comments form <[email protected]>
wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/14/sql-insert.html
> Description:
>
> It looks like INSERT INTO ... RETURNING allows defining a target for the
> returned values like SELECT ... INTO does.
>
> This could be mentioned in the synopsis, or at least in the description of
> "output_expression", maybe even garnished with an example.
>
>
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.

If you look you'll notice a corresponding lack of "INTO" on the SELECT
Command reference page as well, for the same reason.

David J.


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Mention RETURNING ... INTO target
  2022-06-07 18:31 Mention RETURNING ... INTO target PG Doc comments form <[email protected]>
  2022-06-07 20:47 ` Re: Mention RETURNING ... INTO target David G. Johnston <[email protected]>
@ 2022-06-07 21:07   ` Tom Lane <[email protected]>
  2022-06-07 21:23     ` Re[2]: Mention RETURNING ... INTO target Stefan Schmiedl <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2022-06-07 21:07 UTC (permalink / raw)
  To: David G. Johnston <[email protected]>; +Cc: [email protected]; Pg Docs <[email protected]>

"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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re[2]: Mention RETURNING ... INTO target
  2022-06-07 18:31 Mention RETURNING ... INTO target PG Doc comments form <[email protected]>
  2022-06-07 20:47 ` Re: Mention RETURNING ... INTO target David G. Johnston <[email protected]>
  2022-06-07 21:07   ` Re: Mention RETURNING ... INTO target Tom Lane <[email protected]>
@ 2022-06-07 21:23     ` Stefan Schmiedl <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Stefan Schmiedl @ 2022-06-07 21:23 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; David G. Johnston <[email protected]>; +Cc: Pg Docs <[email protected]>

--------=_MB4EDEB707-41FE-474E-9A07-8C4DC5C2EA5B
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-06-07 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 18:31 Mention RETURNING ... INTO target PG Doc comments form <[email protected]>
2022-06-07 20:47 ` David G. Johnston <[email protected]>
2022-06-07 21:07   ` Tom Lane <[email protected]>
2022-06-07 21:23     ` Re[2]: Mention RETURNING ... INTO target Stefan Schmiedl <[email protected]>

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