Re: Bug about column references within subqueries used in selects

From: NikhilS <nikkhils(at)gmail(dot)com>
To: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug about column references within subqueries used in selects
Date: 2007-04-12 12:56:14
Message-ID: d3c4af540704120556l4a64f523sf77b9e67540ce3e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 4/12/07, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
> On 4/12/07, NikhilS <nikkhils(at)gmail(dot)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;

Yes this is fine, but in "select columnname from tablename" using column
references of the other involved table is what I am objecting to.

Regards,
Nikhils

--
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian G. Pflug 2007-04-12 13:06:18 What tools do people use to hack on PostgreSQL?
Previous Message Gurjeet Singh 2007-04-12 12:55:14 Re: [HACKERS] [Fwd: Index Advisor]