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

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
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 16:47:35
Message-ID: 20091016164735.GA4505@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Muris Pucic wrote:

> -- 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 per spec -- first_name inside the subselect refers to the outer
TABLE1. Misleading, yes.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-10-16 17:02:09 Re: BUG #5121: Segmentation Fault when using pam w/ krb5
Previous Message Douglas, Ryan 2009-10-16 16:46:36 Re: BUG #5121: Segmentation Fault when using pam w/ krb5