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_using_the_wrong_name_in_a_subquery.3F
regards, tom lane