Re: Re: issue: record or row variable cannot be part of multiple-item INTO list

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Anthony Bykov <a(dot)bykov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: issue: record or row variable cannot be part of multiple-item INTO list
Date: 2017-09-19 21:34:21
Message-ID: 3413.1505856861@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Tue, Sep 19, 2017 at 2:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Notice the parens/comma positioning. It's only because text is such
>> a lax datatype that you didn't notice the problem.

> I saw exactly what you described - that it didn't error out and that the
> text representation of the single output composite was being stored in the
> first field of the target composite. i.e., that it "worked". Does that
> fact that it only works if the first field of the composite type is text
> change your opinion that the behavior is OK to break?

No. That's not "working" for any useful value of "working".

I would indeed be happy if we could just change this behavior, but I do
not care to answer to the crowd of villagers that will appear if we do
that. It's just way too easy to do, eg,

declare r record;
...
for r in select lots-o-columns from ... loop ...

and then expect r to contain all the columns of the SELECT, separately.
We can't change that behavior now. (And making FOR behave differently
for this purpose than INTO wouldn't be very nice, either.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2017-09-19 21:35:56 Re: why not parallel seq scan for slow functions
Previous Message Peter Geoghegan 2017-09-19 21:32:32 Re: CREATE COLLATION does not sanitize ICU's BCP 47 language tags. Should it?