Re: Bug about column references within subqueries used in selects - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: Bug about column references within subqueries used in selects
Date
Msg-id b42b73150704120548x68eab92bt1c796b4bd916650e@mail.gmail.com
Whole thread Raw
In response to Bug about column references within subqueries used in selects  (NikhilS <nikkhils@gmail.com>)
Responses Re: Bug about column references within subqueries used in selects
List pgsql-hackers
On 4/12/07, NikhilS <nikkhils@gmail.com> wrote:
> Hi,
>
> Shouldn't the final command below cause a 'column "b" does not exist error'?
>
> create table update_test (a int, b int);
> create table supdate_test(x int, y int);
> insert into update_test values (20, 30);
> insert into supdate_test values (40, 50);
> select a, (select b from supdate_test) from update_test;
>
>          a  ?column?
> ---------- -------------------------
>         20        30
>
> Is the problem with the code in colNameToVar or maybe we should add checks
> in transformSubLink?

I don't think so...the columns of update_test are visible to the
scalar subquery...that way you can use fields from 'a' to filter the
subquery...
select a, (select y from supdate_test where x = a) from update_test;

merlin


pgsql-hackers by date:

Previous
From: NikhilS
Date:
Subject: Bug about column references within subqueries used in selects
Next
From: Jim Nasby
Date:
Subject: Re: elog(FATAL) vs shared memory