From: Tom Lane <tgl@sss.pgh.pa.us>
To: PALAYRET Jacques <jacques.palayret@meteo.fr>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: PostgreSQL : error hint for LATERAL join
Date: Mon, 11 Apr 2022 10:20:06 -0400
Message-ID: <267695.1649686806@sss.pgh.pa.us> (raw)
In-Reply-To: <1512389835.55848519.1649664015407.JavaMail.zimbra@meteo.fr>
References: <472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr>
<CAKFQuwa7Bix0R9NX2JyKtJE-xwhVCk4F=nb0Dp-FtQErS3jX7A@mail.gmail.com>
<1512389835.55848519.1649664015407.JavaMail.zimbra@meteo.fr>
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.
Given
CREATE TABLE t (x float8);
all five of these are syntactically legal (with or without the
implied LATERAL):
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;
The only way to get to the error in question is to write something
like
SELECT * FROM t FULL JOIN sin(x) ON true;
If that's what you have, then changing FULL to INNER or LEFT will
produce a syntactically legal query; changing it to CROSS will not
unless you make additional changes (which'd be hard if the ON
condition were nontrivial).
Also, if we were trying to be completionist, we'd have to somehow
work in the comma and implicit-INNER syntaxes, which would surely
make the hint a confusing mess.
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.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, jacques.palayret@meteo.fr, david.g.johnston@gmail.com
Subject: Re: PostgreSQL : error hint for LATERAL join
In-Reply-To: <267695.1649686806@sss.pgh.pa.us>
References: <472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr> <CAKFQuwa7Bix0R9NX2JyKtJE-xwhVCk4F=nb0Dp-FtQErS3jX7A@mail.gmail.com> <1512389835.55848519.1649664015407.JavaMail.zimbra@meteo.fr> <267695.1649686806@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox