>>>>> "bill" == bill wilson <bill.wilson.h...@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 not exists (select
 bill> true from (select 2 as a) t2 where a=a) ;
 bill>  a
 bill> ───
 bill> (0 rows)

 bill> Please tell me this a bug. We can see in the first query
 bill> without naming the tables that 'a=a' uses table t2 for both
 bill> 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)


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to