Re: final patch - plpgsql: for-in-array

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Valentine Gogichashvili <valgog(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: final patch - plpgsql: for-in-array
Date: 2010-11-22 14:29:43
Message-ID: AANLkTi=iQu5ULNjO+L9OzPbQOseJ55r5c-atHbytAu2-@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 22, 2010 at 6:21 AM, Valentine Gogichashvili
<valgog(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-11-22 14:36:59 Re: final patch - plpgsql: for-in-array
Previous Message Robert Haas 2010-11-22 14:15:17 Re: Re: Proposed Windows-specific change: Enable crash dumps (like core files)