pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PALAYRET Jacques <jacques.palayret@meteo.fr>
To: pgsql-general@postgresql.org
Subject: PostgreSQL : error hint for LATERAL join
Date: Fri, 8 Apr 2022 10:29:06 +0200 (CEST)
Message-ID: <472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr> (raw)

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 

view thread (5+ messages)  latest in thread

Message-ID: <472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr>
Permalink:  ../472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr/
Also on:    postgresql.org/message-id/472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr

 · 

reply

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: jacques.palayret@meteo.fr
  Subject: Re: PostgreSQL : error hint for LATERAL join
  In-Reply-To: <472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr>
  References: <472671960.55252257.1649406546838.JavaMail.zimbra@meteo.fr>

* 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