From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: issue: record or row variable cannot be part of multiple-item INTO list |
Date: | 2017-05-13 20:20:04 |
Message-ID: | 19190.1494706804@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> I am working on migration large Oracle application to Postgres. When I
> started migration procedures with OUT parameters I found following limit
> "record or row variable cannot be part of multiple-item INTO list"
IIRC, the reason for disallowing that is that it's totally unclear what
the semantics ought to be. Is that variable a single target (demanding
a compatible composite-valued column from the source query), or does it
eat one source column per field within the record/row? The former is 100%
inconsistent with what happens if the record/row is the only INTO target;
while the latter would be very bug-prone, and it's especially unclear what
ought to happen if it's an as-yet-undefined record variable.
Yeah, we could invent some semantics or other, but I think it would
mostly be a foot-gun for unwary programmers.
We do allow you to write out the columns individually for such cases:
SELECT ... INTO v1, rowvar.c1, rowvar.c2, rowvar.c3, v2 ...
and I think it's better to encourage people to stick to that.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-05-13 20:22:34 | Re: logical decoding of two-phase transactions |
Previous Message | Dmitry Dolgov | 2017-05-13 19:42:32 | Re: logical decoding of two-phase transactions |