public inbox for [email protected]
help / color / mirror / Atom feedFrom: Chamath Sajeewa <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Subject: Re: PGSQL returning into in insert statement
Date: Thu, 30 Jul 2020 12:26:26 +0530
Message-ID: <CACpofeiBnKyFFf4a3_rFGSkx+_18drQVBv6mMkYQo4W5+oi0JA@mail.gmail.com> (raw)
In-Reply-To: <CACpofejjgSR_TGVwLb8cBJ=wnuf_g1MH+Aogc3mMNSRwP3C6mg@mail.gmail.com>
References: <CACpofegcG+Ke2r4yoCpwRKPnV8r+fiGfB1w=ur4M3KHvTFKkpg@mail.gmail.com>
<[email protected]>
<CACpofejjgSR_TGVwLb8cBJ=wnuf_g1MH+Aogc3mMNSRwP3C6mg@mail.gmail.com>
Btw oracle support this in plain sql too.
On Thu, 30 Jul 2020, 11:42 Chamath Sajeewa, <[email protected]> wrote:
> Understood. Thank you!
>
> On Thu, 30 Jul 2020, 08:35 Tom Lane, <[email protected]> wrote:
>
>> Chamath Sajeewa <[email protected]> writes:
>> > I want to use "returning into" in insert statement. I tried below,
>>
>> > insert into test_table(key,value) values('key1',5) returning value into
>> > returnvalue;
>>
>> > and below error occurred- syntax error at or near "into".
>>
>> That is perfectly legit syntax within a plpgsql function, but it
>> would produce the mentioned syntax error if you tried to use it
>> directly at the SQL level. So I conclude that you're fuzzy about
>> the difference between SQL and plpgsql. You can use plpgsql
>> statements within plpgsql-language function definitions, and
>> within DO blocks. But not as plain SQL. (Plain SQL has no concept
>> of variables either, so "into returnvalue" makes no sense there
>> anyway.)
>>
>> regards, tom lane
>>
>
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: PGSQL returning into in insert statement
In-Reply-To: <CACpofeiBnKyFFf4a3_rFGSkx+_18drQVBv6mMkYQo4W5+oi0JA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox