Re: BUG #18001: Invalid subquery passed as true

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: pvham90(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18001: Invalid subquery passed as true
Date: 2023-06-26 11:34:30
Message-ID: CAOBaU_b8UPDc-bJaOj2ELW4Y+zRi9fUFv3fU--mmV5g3LcDgtg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

hi

On Mon, 26 Jun 2023, 19:11 PG Bug reporting form, <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 18001
> Logged by: Piet van Ham
> Email address: pvham90(at)gmail(dot)com
> PostgreSQL version: 11.20
> Operating system: Linux
> Description:
>
> create table table_a (column_a varchar(16), column_b varchar(16));
> create table table_b (column_c varchar(16), column_d varchar(16));
>
> insert into table_a (column_a, column_b) values ('row1a','row1b');
> insert into table_b (column_c, column_d) values ('row2a','row2b');
>
> delete from table_a where column_a in (select column_a from table_b); --the
> subquery is invalid, but the where clause is passed as true resulting in
> all
> records deleted
>
> select count(*) from table_a;
> -- 0
>

this is unfortunately working as required by the sql standard, see
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

>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2023-06-26 23:48:12 Re: BUG #17949: Adding an index introduces serialisation anomalies.
Previous Message PG Bug reporting form 2023-06-26 10:07:11 BUG #18001: Invalid subquery passed as true