Re: Mention RETURNING ... INTO target

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) 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>
Subject: Re: Mention RETURNING ... INTO target
Date: 2022-06-07 21:07:30
Message-ID: 1334778.1654636050@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

"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

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2022-06-07 21:07:41 Re: correction
Previous Message David G. Johnston 2022-06-07 20:47:14 Re: Mention RETURNING ... INTO target