Re: subselect on nonexistent column succeeds!!?!

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: James Robinson <jlrobins(at)socialserve(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: subselect on nonexistent column succeeds!!?!
Date: 2004-07-01 19:35:54
Message-ID: 20040701123253.Q35614@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Roberto João Lopes Garcia 2004-07-01 19:42:29 string concatenator || and NULL values
Previous Message James Robinson 2004-07-01 18:05:25 subselect on nonexistent column succeeds!!?!