Re: Combining scalar and row types in RETURNING - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Combining scalar and row types in RETURNING
Date
Msg-id 228703a6-f1bf-4af8-a5d6-4edb5bcaa8cf@aklaver.com
Whole thread Raw
In response to Re: Combining scalar and row types in RETURNING  (Ray O'Donnell <ray@rodonnell.ie>)
List pgsql-general
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?

> 
> Thanks once more,
> 
> Ray.
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Ray O'Donnell
Date:
Subject: Re: Combining scalar and row types in RETURNING
Next
From: Tom Lane
Date:
Subject: Re: Combining scalar and row types in RETURNING