On Wed, Dec 31, 2014 at 5:41 PM, Ronald Peterson <ron@hub.yellowbank.com> wrote:
> Thanks much. Didn't know about LATERAL. That's a solution. Seems like the
> implementation could be improved though. The existence of LATERAL seems to
> imply that it's possible. Why introduce more complicated syntax? Of course
> the syntax applies to more situations than this one. But this case seems
> like it could be improved.
Well, LATERAL is SQL standard syntax, and the SQL standard expressly
forbids using 'lateral refrences' between table expressions (see here:
http://rhaas.blogspot.com/2010/04/finding-our-way-to-lateral.html for
some background info). As to why they did it, I don't know, but
there' probably some complicated reason where not having that syntax
broke or made ambiguous existing stuff. Given that, it's not likely
to change.
merlin