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

Re: BUG #5122: Subqueries - inner select statement bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Muris Pucic" <trax(at)multicom(dot)ba>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5122: Subqueries - inner select statement bug
Date: 2009-10-16 13:51:12
Message-ID: 5338.1255701072@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Muris Pucic" <trax(at)multicom(dot)ba> writes:
> -- The query below works, even though there is no column "first_name" in
> TABLE2. This should return an error but it does not, it returns all rows
> from TABLE1. This query should not evaluate correctly even when aliases are
> not used because it can be misleading.

> SELECT * FROM TABLE1 WHERE first_name IN (SELECT first_name FROM TABLE2)

This is not a bug, it's a perfectly legal outer reference.  It is
required to work that way by the SQL standard.  If you think it's
a bad design, take it up with the ISO standards committee.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2009-10-16 13:55:28
Subject: Re: BUG #5123: bug in window function "last_value"
Previous:From: Heikki LinnakangasDate: 2009-10-16 13:49:54
Subject: Re: BUG #5122: Subqueries - inner select statement bug

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