Re: PostgreSQL : error hint for LATERAL join - Mailing list pgsql-general

From David G. Johnston
Subject Re: PostgreSQL : error hint for LATERAL join
Date
Msg-id CAKFQuwaD61G9nRHEXFksOUrH_RjczWN4Ec3M+BfUvMb2QLrd0A@mail.gmail.com
Whole thread Raw
In response to Re: PostgreSQL : error hint for LATERAL join  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Mon, Apr 11, 2022 at 7:20 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
PALAYRET Jacques <jacques.palayret@meteo.fr> writes:
> For me, one of the two following things should be true : either the hint (in case of a lateral error) is incomplete or the possibility of " cross join lateral " should be removed.
 

The reason the hint is worded the way it is is a practical one: the other
possibilities are not drop-in syntactic replacements.

[...] 

        SELECT * FROM t, sin(x);
        SELECT * FROM t CROSS JOIN sin(x);
        SELECT * FROM t JOIN sin(x) ON true;
        SELECT * FROM t INNER JOIN sin(x) ON true;
        SELECT * FROM t LEFT JOIN sin(x) ON true;


Another way to look at it is that there are only two allowed
semantic behaviors here: INNER and LEFT joins.  The fact that
there's more than one way to spell an inner join is a historical
accident.


Agreed on both points, and a hat-tip for the former.

I did get somewhat annoyed previously that I had to write "on true" (I considered that a code smell) but decided it was a better option than both "t, six(x)" and "t cross join sin(x)" as I dislike the implicit format even more and the semantic mis-match with the cross join was unappealing as well.  There really is no other option for a LEFT JOIN here so just the consistency with an INNER JOIN has now made writing "on true", at least for a lateral join, make sense to me.

David J.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: PostgreSQL : error hint for LATERAL join
Next
From: Rob Sargent
Date:
Subject: How easy is it to lose permissions in 'public' schema?