From: PALAYRET Jacques <jacques.palayret@meteo.fr>
To: PostgreSQL mailing lists <pgsql-general@postgresql.org>
Subject: Re: PostgreSQL : bug (ou not) in CTE Common Table Expressions or Subqueries in the FROM Clause
Date: Tue, 22 Mar 2022 13:48:21 +0100 (CET)
Message-ID: <812470944.47219637.1647953301941.JavaMail.zimbra@meteo.fr> (raw)
In-Reply-To: <CAKkG4_nQi6PWU3-rftkTr=8g3u5mB6QV9bFjODRNw2eXKrwOHg@mail.gmail.com>
References: <1370619684.47054020.1647942355596.JavaMail.zimbra@meteo.fr>
<CAKkG4_nQi6PWU3-rftkTr=8g3u5mB6QV9bFjODRNw2eXKrwOHg@mail.gmail.com>
Thanks a lot.
Visibly, you are right.
It's a correlated statement, OK, right.
But in the subquery :
(
SELECT x.elev
FROM elev_Tlse_Blagnac AS x
WHERE w.id BETWEEN 31000000 and 31999999
)
the WHERE clause (= w.id BETWEEN 31000000 and 31999999) is for the SELECT x.elev FROM elev_Tlse_Blagnac
which is the value 151 (one line, one value), correlation or not.
So, for me, it should NOT be a WHERE clause (a condition) for the MAIN statement.
According to me, there is only one condition in the main statement (SELECT w.id, w.name, w.elev FROM weather_stations ...)
and it is : elev > 151 (correlation ou not correlation).
In others words : for each line of table weather_stations), the only condition is : is the elev superior than the elev returned by the subquery, 151 ?
Visibly, the correlated statement adds one condition (w.id BETWEEN 31000000 and 31999999) in the main statement, but it's not logical for me, because of the parentheses.
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 : bug (ou not) in CTE Common Table Expressions or Subqueries in the FROM Clause
In-Reply-To: <812470944.47219637.1647953301941.JavaMail.zimbra@meteo.fr>
References: <1370619684.47054020.1647942355596.JavaMail.zimbra@meteo.fr> <CAKkG4_nQi6PWU3-rftkTr=8g3u5mB6QV9bFjODRNw2eXKrwOHg@mail.gmail.com> <812470944.47219637.1647953301941.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