On Mon, Apr 11, 2022 at 7:20 AM Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
PALAYRET Jacques <jacques.palayret@xxxxxxxx> 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.