Re: final patch - plpgsql: for-in-array - Mailing list pgsql-hackers

From Robert Haas
Subject Re: final patch - plpgsql: for-in-array
Date
Msg-id AANLkTi=iQu5ULNjO+L9OzPbQOseJ55r5c-atHbytAu2-@mail.gmail.com
Whole thread Raw
In response to Re: final patch - plpgsql: for-in-array  (Valentine Gogichashvili <valgog@gmail.com>)
List pgsql-hackers
On Mon, Nov 22, 2010 at 6:21 AM, Valentine Gogichashvili
<valgog@gmail.com> wrote:
> Hi,
> with the FOR e IN SELECT UNNEST(a) construct there is an issue again related
> to the unresting of composite type arrays:
> [ example ]
> Is it a bug or a feature?

It looks like the problem in this example is that PL/pgsql tries to
assign the result of unest(ta) to t.i rather than to t as a whole.
This is pretty ridiculously stupid in this case, but it would make
sense if the subselect where of the form SELECT a, b, c FROM ...

I haven't looked at the code to see whether there's a way to make this
case smarter (it would be nice - I've been bitten by similar problems
myself) but it's only tangentially related to the patch under
discussion.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Re: Proposed Windows-specific change: Enable crash dumps (like core files)
Next
From: Robert Haas
Date:
Subject: Re: final patch - plpgsql: for-in-array