Re: Bug about column references within subqueries used in selects

From: "Bort, Paul" <pbort(at)tmwsystems(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug about column references within subqueries used in selects
Date: 2007-04-12 13:30:07
Message-ID: DB106B1B5B8F734B8FF3E155A3A556C20548D7C7@clemail1.tmwsystems.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> 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.
>

There's nothing here to object to, the system is acting correctly. Your
column name "b" is ambiguous, and the system takes the column "b" that
exists, rather than returning an error on a column that doesn't exist.
If you were explicit in your column name, you would get an error:

=# select a, (select supdate_test.b from supdate_test) from update_test;
ERROR: No such attribute supdate_test.b

Regards,
Paul

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-04-12 13:35:47 Re: What tools do people use to hack on PostgreSQL?
Previous Message Tom Lane 2007-04-12 13:29:52 Re: [HACKERS] Fix mdsync never-ending loop problem