Re: conditional query in where has name collision. bug? - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: conditional query in where has name collision. bug?
Date
Msg-id 87oau9n8lz.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to conditional query in where has name collision. bug?  (bill wilson <bill.wilson.home@gmail.com>)
List pgsql-hackers
>>>>> "bill" == bill wilson <bill.wilson.home@gmail.com> writes:
bill> This a toy example from a 'upsert' script that appends new data:bill> select a from (select 1 as a) as t1 where
notexists (selectbill> true from (select 2 as a) t2 where a=a) ;bill>  abill> ───bill> (0 rows) 
bill> Please tell me this a bug. We can see in the first querybill> without naming the tables that 'a=a' uses table t2
forbothbill> columns. 

Of course it's not a bug. The column "a" in the inner scope hides the
column "a" in the outer scope, as explicitly required by the spec
(6.6 <identifier chain> in sql2008).

--
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: bill wilson
Date:
Subject: conditional query in where has name collision. bug?
Next
From: Alvaro Herrera
Date:
Subject: Re: Minor improvement in lock.sgml