public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ray O'Donnell <[email protected]>
To: Adrian Klaver <[email protected]>
To: Tom Lane <[email protected]>
Cc: 'PostgreSQL' <[email protected]>
Subject: Re: Combining scalar and row types in RETURNING
Date: Tue, 3 Jun 2025 20:08:48 +0000
Message-ID: <0102019737692b90-b251a7ea-b3c5-4477-afff-5986a149580a-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <[email protected]>
References: <01020197369aac89-01a7b7b4-b775-471e-ac8e-de8b28d87008-000000@eu-west-1.amazonses.com>
<[email protected]>
<01020197370480a4-f9b53911-e5a8-4bdb-81e5-de41d5db4d8c-000000@eu-west-1.amazonses.com>
<[email protected]>
On 03/06/2025 20:01, Adrian Klaver wrote:
> On 6/3/25 11:18, Ray O'Donnell wrote:
>> On 03/06/2025 17:53, Tom Lane wrote:
>
>> Thanks a million for the explanation, Tom - that makes sense. I tried
>> what you suggested, with mixed results:
>>
>> (i) Running the MERGE as a stand-alone query, with just RETURNING...
>> , worked - I got a scalar and a row as expected.
>>
>> (ii) Running it in a function (actually a DO block), with m_new
>> correctly declared as the table type, failed with the same error as
>> before.
>>
>> (iii) Running (ii) but with the order of the items in RETURNING
>> reversed -
>>
>> ... returning t, merge_action() into m_new, m_action
>>
>> - gave me a different error:
>>
>> ERROR: record variable cannot be part of multiple-item INTO list
>> LINE 53: m, merge_action() into m_new, m_action
>>
>> ...which seems to answer my question definitively.
>
> This:
>
> ... returning t, merge_action() into m_new, m_action
>
> does not match this:
>
> LINE 53: m, merge_action() into m_new, m_action
>
>
> Is this a copy and paste error or two different invocations of the
> function?
Whoops, sorry, yes, that's a copy-and-paste error - the target table is
aliased as "m" in my original.
Ray.
--
Raymond O'Donnell // Galway // Ireland
[email protected]
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: Combining scalar and row types in RETURNING
In-Reply-To: <0102019737692b90-b251a7ea-b3c5-4477-afff-5986a149580a-000000@eu-west-1.amazonses.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