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

From Tom Lane
Subject Re: final patch - plpgsql: for-in-array
Date
Msg-id 5871.1290108520@sss.pgh.pa.us
Whole thread Raw
In response to Re: final patch - plpgsql: for-in-array  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: final patch - plpgsql: for-in-array
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> "unnest" returns all fields, but
> these fields should not be used. There isn't possible to say - stop, I
> don't need other fields. It's possible just with special PL statement,
> because it is controlled by PL. So it is reason why I don't believe in
> optimizations on PL level.

That is complete nonsense.  array_unnest doesn't return the whole array
contents at once, so it's just as capable of being optimized as any
single-purpose implementation.  If you exit the loop early, you just
don't call it anymore.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: final patch - plpgsql: for-in-array
Next
From: Magnus Hagander
Date:
Subject: Re: Indent authentication overloading