Re: PostgreSQL : error hint for LATERAL join

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PALAYRET Jacques <jacques(dot)palayret(at)meteo(dot)fr>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL : error hint for LATERAL join
Date: 2022-04-11 16:05:31
Message-ID: CAKFQuwaD61G9nRHEXFksOUrH_RjczWN4Ec3M+BfUvMb2QLrd0A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 11, 2022 at 7:20 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> PALAYRET Jacques <jacques(dot)palayret(at)meteo(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Zheng Li 2022-04-11 16:42:01 Re: Support logical replication of DDLs
Previous Message Tom Lane 2022-04-11 14:20:06 Re: PostgreSQL : error hint for LATERAL join