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

From PALAYRET Jacques
Subject PostgreSQL : error hint for LATERAL join
Date
Msg-id 472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr
Whole thread Raw
Responses Re: PostgreSQL : error hint for LATERAL join  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
Hello,

For a LATERAL join, I think the hint (in case of error) is incomplete :

" DÉTAIL : The combining JOIN type must be INNER or LEFT for a LATERAL reference. "
 to be replaced by :
" DÉTAIL : The combining JOIN type must be CROSS, INNER or LEFT for a LATERAL reference. "

Note : it depends on what is needed

SELECT *
FROM (
SELECT 'a'
) t (c1)
 LEFT OUTER JOIN LATERAL (
SELECT 'b', c1
) u(d1) ON true
;
 c1 | d1 | c1
----+----+----
 a  | b  | a
(1 ligne)

SELECT *
FROM (
SELECT 'a'
) t (c1)
 INNER JOIN LATERAL (
SELECT 'b', c1
) u(d1) ON true
;
 c1 | d1 | c1
----+----+----
 a  | b  | a
(1 ligne)

SELECT *
FROM (
SELECT 'a'
) t (c1)
 CROSS JOIN LATERAL (
SELECT 'b', c1
) u(d1)
;
 c1 | d1 | c1
----+----+----
 a  | b  | a
(1 ligne)


Regards
----- Météo-France -----
PALAYRET JACQUES
DCSC/GDC
jacques.palayret@meteo.fr
Fixe : +33 561078319

pgsql-general by date:

Previous
From: friend.have_00@icloud.com
Date:
Subject: Could not read block 0 in file
Next
From: Vijaykumar Jain
Date:
Subject: Re: Could not read block 0 in file