BUG #4250: subquery in query - Mailing list pgsql-bugs

From Wojciech Tylek
Subject BUG #4250: subquery in query
Date
Msg-id 200806172037.m5HKbObv080240@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4250: subquery in query
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4250
Logged by:          Wojciech Tylek
Email address:      wat@wat.net.pl
PostgreSQL version: 8.1,8.2,8.3
Operating system:   Linux
Description:        subquery in query
Details:

There are two example tables:

create table a (
  a_id serial primary key,
  sth varchar
  -- anything else
);

create table b (
  b_id serial primary key,
  a_id int references a(a_id),
  sth int
  --anything else
);

The question is:
Why the query like:

select * from b where a_id in (select a_id from a where b_id in (10,20));

does not return error?
The table "a" does not have b_id!
And for example a query (which is a subquery in above): select a_id from a
where b_id in (10,20);
returns ERROR:  column "b_id" does not exist.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #4247: (Possible) SQL miscontruct not flagged
Next
From: "Kevin Grittner"
Date:
Subject: Re: BUG #4250: subquery in query