Re: LATERAL - Mailing list pgsql-hackers

From Robert Haas
Subject Re: LATERAL
Date
Msg-id 603c8f070909071706k62e66223tcaf3828970cb8559@mail.gmail.com
Whole thread Raw
In response to Re: LATERAL  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: LATERAL
Re: LATERAL
List pgsql-hackers
On Mon, Sep 7, 2009 at 7:47 PM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Mon, Sep 7, 2009 at 3:43 AM, Peter Eisentraut<peter_e@gmx.net> wrote:
>>> You could argue that the parser could infer the references and the
>>> resultant join ordering restrictions automatically, but perhaps it was
>>> deemed that an explicit specification would be less error-prone.
>
>> Well, the irony is that our current code does already infer the
>> references - and then disallows them.
>
> Because as often as not, they're mistakes.  Please don't think
> you're smarter than the spec here.

You're frequently the first to criticize the spec, but I have no
interest in second-guessing whatever behavior the spec specifies for
this construct.  I'm just trying to understand it, and as far as I can
tell, LATERAL() is just a piece of syntactic sugar that allows
expressions within to reference FROM items at the same query level.
As far as I can tell, it doesn't change the semantic of any legal
queries - it just renders legal notation that otherwise would be
rejected.  But is my understanding correct?

I haven't got a copy of the spec, so that's a bit of a handicap.  If
someone who does can look this up and comment on how it's supposed to
work, I would certainly appreciate that.  My understanding of it is
currently based on random articles cherry-picked around the Internet
and a handful of emails from archives.postgresql.org, which seems a
little thin.

...Robert


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: LATERAL
Next
From: Alvaro Herrera
Date:
Subject: Re: LATERAL