Skip site navigation (1) Skip section navigation (2)

BUG #4250: subquery in query

From: "Wojciech Tylek" <wat(at)wat(dot)net(dot)pl>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4250: subquery in query
Date: 2008-06-17 20:37:24
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      4250
Logged by:          Wojciech Tylek
Email address:      wat(at)wat(dot)net(dot)pl
PostgreSQL version: 8.1,8.2,8.3
Operating system:   Linux
Description:        subquery in query

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

Next:From: Kevin GrittnerDate: 2008-06-17 21:55:54
Subject: Re: BUG #4250: subquery in query
Previous:From: Tom LaneDate: 2008-06-17 17:47:13
Subject: Re: BUG #4247: (Possible) SQL miscontruct not flagged

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group