Re: LATERAL - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: LATERAL
Date
Msg-id 20090908011217.GF17756@tamriel.snowman.net
Whole thread Raw
In response to Re: LATERAL  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: LATERAL
List pgsql-hackers
Robert,

* Robert Haas (robertmhaas@gmail.com) wrote:
> On Mon, Sep 7, 2009 at 7:47 PM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
> > 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 not entirely sure you followed what Tom was getting at here.  If you
did, feel free to ignore me.

> 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.

What I'm gathering is that this may be correct, though I don't know for
sure.  The point I think Tom was making is that even if it *is* just
syntactic sugar, we don't want to allow expressions to reference FROM
items at the same query level *unless* LATERAL is specified.  Your
earlier comments sounded like you would want to implement allowing
expressions to refer to FROM items at the same query level without
LATERAL being specified.

> 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.

You can get a 'draft' that's very close to the spec pretty easily..
Just do '??sql' in IRC sometime..
Enjoy,
    Stephen

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: LATERAL
Next
From: Robert Haas
Date:
Subject: Re: LATERAL