Re: LATERAL, UNNEST and spec compliance - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: LATERAL, UNNEST and spec compliance
Date
Msg-id 20130125181424.GS16126@tamriel.snowman.net
Whole thread Raw
In response to LATERAL, UNNEST and spec compliance  (David Fetter <david@fetter.org>)
Responses Re: LATERAL, UNNEST and spec compliance
List pgsql-hackers
* David Fetter (david@fetter.org) wrote:
> As I see it, the current options are:
>
> 1. Do nothing, and insist on non-standard use of the LATERAL keyword.

I'm not a big fan of this.  Providing a good error message saying "you
need to use LATERAL for this query to work" makes it slightly better,
but I don't feel like there's really any ambiguity here.

> 2. Add UNNEST to the grammar (or parse analysis) as a special case, making
>    it implicitly LATERAL.
>
>    (This would make implementing S301 easier, but special cases are ugly.)

This I really don't like.

> 3. Make all cases of SRFs in the FROM-clause implicitly LATERAL.
>
>    (As far as I can tell, those cases whose behaviour would be changed by
>    this actually produce errors in versions prior to 9.3, so no working
>    code should be affected.)

+1 for me on this idea.  If you're calling an SRF, passing in a lateral
value, 'LATERAL' seems like it's just a noise word, and apparently the
SQL authors felt the same, as they don't require it for unnest().

> Since LATERAL is new in 9.3, I think the pros and cons of these choices
> should be considered now, rather than being allowed to slide by unexamined.

I agree that we should really hammer this down before 9.3 is out the
door.
Thanks,
    Stephen

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: COPY FREEZE has no warning
Next
From: Tom Lane
Date:
Subject: Re: autovacuum not prioritising for-wraparound tables