From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Ray O'Donnell" <ray(at)rodonnell(dot)ie> |
Cc: | "'PostgreSQL'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Combining scalar and row types in RETURNING |
Date: | 2025-06-03 19:31:34 |
Message-ID: | 877615.1748979094@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Ray O'Donnell" <ray(at)rodonnell(dot)ie> writes:
> (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.
Ah, after looking at the source code in that area, plpgsql
allows the INTO target to be either a single composite
variable, or one or more non-composite variables; the
argument being that otherwise it's too hard to decide which
RETURNING items match which INTO items.
But I think maybe there is still a solution:
declare
m_into record;
...
returning
merge_action() m, t
into
m_into;
... then fetch m_into.m and m_into.t (the latter will be
a composite field). I didn't try this approach though.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Ray O'Donnell | 2025-06-03 20:08:48 | Re: Combining scalar and row types in RETURNING |
Previous Message | Matthew Tice | 2025-06-03 19:22:33 | Sudden increase in n_dead_tup with no corresponding insert/update/delete |