Re: [HACKERS] issue: record or row variable cannot be part of multiple-item INTO list - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] issue: record or row variable cannot be part of multiple-item INTO list
Date
Msg-id 19190.1494706804@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] issue: record or row variable cannot be part of multiple-item INTO list  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: [HACKERS] issue: record or row variable cannot be part ofmultiple-item INTO list  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: [HACKERS] issue: record or row variable cannot be part ofmultiple-item INTO list  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.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



pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions