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

From Bort, Paul
Subject Re: Bug about column references within subqueries used in selects
Date
Msg-id DB106B1B5B8F734B8FF3E155A3A556C20548D7C7@clemail1.tmwsystems.com
Whole thread Raw
In response to Re: Bug about column references within subqueries used in selects  (NikhilS <nikkhils@gmail.com>)
List 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


pgsql-hackers by date:

Previous
From: Ranjan Sahoo
Date:
Subject: Benchmarking tools for the Postgres, EDB and Oracle Database
Next
From: Andrew Dunstan
Date:
Subject: Re: What tools do people use to hack on PostgreSQL?