From: | "Stefan Schmiedl" <s(at)xss(dot)de> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | "Pg Docs" <pgsql-docs(at)lists(dot)postgresql(dot)org> |
Subject: | Re[2]: Mention RETURNING ... INTO target |
Date: | 2022-06-07 21:23:22 |
Message-ID: | em5730003d-f62e-442f-887c-b340b57309a5@89ddd194.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
From "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc s(at)xss(dot)de; "Pg Docs" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Date 07.06.2022 23:07:30
Subject Re: Mention RETURNING ... INTO target
>"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
>>On Tue, Jun 7, 2022 at 1:30 PM PG Doc comments form <noreply(at)postgresql(dot)org>
>>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.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-06-07 21:40:41 | Re: correction |
Previous Message | Bruce Momjian | 2022-06-07 21:07:41 | Re: correction |