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

BUG #5122: Subqueries - inner select statement bug

From: "Muris Pucic" <trax(at)multicom(dot)ba>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #5122: Subqueries - inner select statement bug
Date: 2009-10-16 07:26:14
Message-ID: 200910160726.n9G7QEEg097413@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      5122
Logged by:          Muris Pucic
Email address:      trax(at)multicom(dot)ba
PostgreSQL version: 8.2
Operating system:   Vista
Description:        Subqueries - inner select statement bug
Details: 

Hi,

If we have two simple tables:

TABLE1
------
id
first_name

TABLE2
------
id
last_name

##############
EXAMPLE QUERY:
##############

-- 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)


-- The query below works as expected

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


Regards,
Muris

www.elektronika.ba

Responses

pgsql-bugs by date

Next:From: AndreyDate: 2009-10-16 07:54:39
Subject: BUG #5123: bug in window function "last_value"
Previous:From: Douglas, RyanDate: 2009-10-16 05:27:40
Subject: Re: BUG #5121: Segmentation Fault when using pam w/ krb5

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