From: Tom Lane <tgl@sss.pgh.pa.us>
To: gurmokh.sangha@starlingbank.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17754: Subquery IN clause returns row matches where subquery is invalid
Date: Thu, 19 Jan 2023 14:42:48 -0500
Message-ID: <4191911.1674157368@sss.pgh.pa.us> (raw)
In-Reply-To: <17754-0c04a53e0078e5d6@postgresql.org>
References: <17754-0c04a53e0078e5d6@postgresql.org>
PG Bug reporting form <noreply@postgresql.org> writes:
> A subquery that has an incorrect column name, that happens to match a column
> name in the outer query evaluates as true for all rows in the outer query.
Such a reference is called an "outer reference", and it's a required
feature in the SQL standard. The reason you get "true" is that the
expression
> where a in ( select a from btable where c = 10) ;
is basically reducing to "a = a".
https://wiki.postgresql.org/wiki/FAQ#Why_doesn.27t_PostgreSQL_report_a_column_not_found_error_when_u...
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, gurmokh.sangha@starlingbank.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17754: Subquery IN clause returns row matches where subquery is invalid
In-Reply-To: <4191911.1674157368@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