Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyg6z-00089t-Ue for pgsql-docs@arkaria.postgresql.org; Tue, 07 Jun 2022 20:47:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nyg6y-00070A-Bd for pgsql-docs@arkaria.postgresql.org; Tue, 07 Jun 2022 20:47:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nyg6y-000701-1l for pgsql-docs@lists.postgresql.org; Tue, 07 Jun 2022 20:47:36 +0000 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nyg6v-0005pG-A0 for pgsql-docs@lists.postgresql.org; Tue, 07 Jun 2022 20:47:35 +0000 Received: by mail-ej1-x62f.google.com with SMTP id y19so37553606ejq.6 for ; Tue, 07 Jun 2022 13:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=5Rt/EiwiODEBHwNC2pekeNigmlQVFmDfwBpnSt9xMaI=; b=jGE+NLFeIiX3BoZISxvKllSNee2hmQxXYqEn0TpC/oYCa1+x0Y7rTIscSkI3L1Kpbn bEQPYyMAOatOC7NMkpNp/ApDnZUlAEeZWDQib8Cqhm5U/7NdquiS2CCcp6A/hA+Vtc0I 2iyfOZ4Px3/xvLLQ7Hwfm/t9uUbcqK33UvCyl2L6ovxmP9noU1rVWAwxN5jS7hcCFkI6 am7Dzs92boKu38LPhgnqBZl0hR5BbHcIfN1hFAMmTdNJM4A7oYD/muLVY0lM0uVdMSLU omPTXe8avPCD/3iyDca/Yb7SnqVbe5y9SsE7N/yo8/wIrLO8hovFlbGN14bL0O64OUKm SCeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=5Rt/EiwiODEBHwNC2pekeNigmlQVFmDfwBpnSt9xMaI=; b=Gwn+oZl6pFUZ2+WNoSfJLJdtOMmtwaTtfDe2J7WTVkNkgtRdpvvyL9fFLedwHGmy5U FtmAO/CBKssGQI3rblFDcd3+7+meekJZrmjVyw7+w3sKESDRPwDcP/OB/hBi+MQJSbBd qJ8FhceV9z2nqo+FnJh9FZbB4XSoZghQqJwbZKVDAJrJdF89VTluIHIpRGPul7SNeq8b f87JI2jcC6b1C378bGYyCvN0FFgefigIRogFcYB28ju/2Vca4qVUtoSzjVIjLJ5rpwZ5 /DUq0r1oak07Oe1wFLjM5O2VnjSQs2s2utxWaj/wuU9Dp5Ty2f1x8aTXnesu2QgWDxWL 2UOw== X-Gm-Message-State: AOAM532PjLf/eFyd35lpr4BylPTkOJlsShrvXFi+EsI5nNiuq5QNCxts n8Ad36sMazz8LDA5070/LGFcAufeJS+604JXgSsmxCKb X-Google-Smtp-Source: ABdhPJw0affpx58McpYSOSgk/o0WbD4G4Jo72CHXx0dFpIgrWu2XsPJFf5yUAb2B9UzF6Y8HkCfSca6yzHJplH015sE= X-Received: by 2002:a17:906:90c7:b0:70c:d506:7821 with SMTP id v7-20020a17090690c700b0070cd5067821mr25343247ejw.259.1654634851689; Tue, 07 Jun 2022 13:47:31 -0700 (PDT) MIME-Version: 1.0 References: <165462669652.573549.16368658459297802851@wrigleys.postgresql.org> In-Reply-To: <165462669652.573549.16368658459297802851@wrigleys.postgresql.org> From: "David G. Johnston" Date: Tue, 7 Jun 2022 13:47:14 -0700 Message-ID: Subject: Re: Mention RETURNING ... INTO target To: s@xss.de, Pg Docs Content-Type: multipart/alternative; boundary="00000000000091699305e0e1b268" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000091699305e0e1b268 Content-Type: text/plain; charset="UTF-8" n Tue, Jun 7, 2022 at 1:30 PM PG Doc comments form 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. --00000000000091699305e0e1b268 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
n Tue, Jun 7, 2022 at 1:30 PM PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged o= n the website:

Page: https://www.postgresql.org/docs/14/sql-inser= t.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<= br> "output_expression", maybe even garnished with an example.

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

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

David J.

--00000000000091699305e0e1b268--