Tom Lane writes:

> > With sufficiently blurred vision one might even find SQL99's clause
> >          <collection derived table> ::=
> >               UNNEST <left paren> <collection value expression> <right paren>
> > applicable.  Or maybe not.
>
> Hm.  I'm not sure what UNNEST does, but now that you bring SQL99 into
> the picture, what about WITH?  That might solve the problem, because
> (I think) WITH tables are logically determined before the main SELECT
> begins to execute.

The SQL 200x draft defines a new clause TABLE ( <collection value
expression> ) as a possible <table primary>, where the <collection value
expression> is required to be a function call.  At the end this just boils
down to UNNEST, though.  UNNEST is defined in terms of a hairy recursive
join subquery with a LATERAL( ) around it.  LATERAL(subquery) is the same
as just (subquery) except that the scope clauses are different.  So I
think this is probably what we ought to look at.

-- 
Peter Eisentraut   [EMAIL PROTECTED]


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to