From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | vadim(at)sable(dot)krasnoyarsk(dot)su (Vadim B(dot) Mikheev) |
Cc: | hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] what standard say ... |
Date: | 1998-02-06 16:23:57 |
Message-ID: | 199802061623.LAA08918@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
> vac=> \d test
>
> Table = test
> +----------------------------------+----------------------------------+-------+
> | Field | Type | Length|
> +----------------------------------+----------------------------------+-------+
> | x | int4 | 4 |
> | y | int4 | 4 |
> +----------------------------------+----------------------------------+-------+
> vac=> select count(*) from test where exists (select t1.y from test t1 where t1.y = x);
> ^
> Is this correlated subquery or not ?
> (Note, that I don't use x with t1. prefix here)
> With current parser this works as un-correlated subquery...
> Is this Ok and I have to re-write query as
>
> vac=> select count(*) from test t2 where exists
> ^^
> (select t1.y from test t1 where t1.y = t2.x);
> ^^^
> to get correlated one ?
>
> Vadim
>
>
I am almost sure this is uncorrelated. If an unqualified varaiable
appears in a subquery, it matches the closest table it can find.
I am not sure about the standard, but logic would suggest this is the
way it should work.
And, of course, that is what the parser does.
--
Bruce Momjian
maillist(at)candle(dot)pha(dot)pa(dot)us
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas DBT | 1998-02-06 16:29:10 | Re: what standard say ... |
Previous Message | Vadim B. Mikheev | 1998-02-06 16:00:54 | Re: [HACKERS] Profile of current backend |