From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Ray O'Donnell <ray(at)rodonnell(dot)ie>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | 'PostgreSQL' <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Combining scalar and row types in RETURNING |
Date: | 2025-06-03 19:01:25 |
Message-ID: | 228703a6-f1bf-4af8-a5d6-4edb5bcaa8cf@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew Tice | 2025-06-03 19:22:33 | Sudden increase in n_dead_tup with no corresponding insert/update/delete |
Previous Message | Ray O'Donnell | 2025-06-03 18:18:51 | Re: Combining scalar and row types in RETURNING |