Re: BUG #13748: Syntax error not emitted - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #13748: Syntax error not emitted
Date
Msg-id 23596.1446168171@sss.pgh.pa.us
Whole thread Raw
In response to BUG #13748: Syntax error not emitted  (adam.c.scott@gmail.com)
List pgsql-bugs
adam.c.scott@gmail.com writes:
> create table administrators (pk integer, login_pk integer);
> create table logins (pk integer, name character varying(64));
> select * from administrators where login_pk in (select login_pk from
> logins);

> It should say something along the lines of:
> ERROR:  column "login_pk" does not exist

Unfortunately not, because that's a perfectly SQL-standard outer reference
in a subquery.

Many people have adopted the habit of always table-qualifying column
references in subqueries to save themselves from this type of mistake.
That is, if you'd done something like

select * from administrators a where a.login_pk in
  (select l.login_pk from logins l);

then you would indeed have gotten a complaint about l.login_pk not
being found in the expected table.

            regards, tom lane

pgsql-bugs by date:

Previous
From: adam.c.scott@gmail.com
Date:
Subject: BUG #13748: Syntax error not emitted
Next
From: daveg@sonic.net
Date:
Subject: BUG #13750: Autovacuum slows down with large numbers of tables. More workers makes it slower.