Re: subselect on nonexistent column succeeds!!?! - Mailing list pgsql-bugs

From Stephan Szabo
Subject Re: subselect on nonexistent column succeeds!!?!
Date
Msg-id 20040701123253.Q35614@megazone.bigpanda.com
Whole thread Raw
In response to subselect on nonexistent column succeeds!!?!  (James Robinson <jlrobins@socialserve.com>)
List pgsql-bugs
On Thu, 1 Jul 2004, James Robinson wrote:

> Why in the world does this statement parse and run:
>
> orig_sav=# delete from realtycompany_contacts where contact_id in
> (select contact_id from users);
> DELETE 1634
>
> Since users has *no* column contact_id ? One would expect the statement
> to fail, and the transaction to get rolled back.

AFAIK the spec requires that subselects like that can reference outer
columns so contact_id inside the subselect refers to the outer contact_id
column which does exist (which makes the effective behavior of the above
clause the same as contact_id is not null I think)

pgsql-bugs by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Possible bug?
Next
From: Eric AVRILLON
Date:
Subject: problem installing on aix 4.3.3