BUG #1540: Enhancement request: 'ambiguous' column reference in psql

Поиск
Список
Период
Сортировка
От Richard Neill
Тема BUG #1540: Enhancement request: 'ambiguous' column reference in psql
Дата
Msg-id 20050313075138.803FDF0BA5@svr2.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #1540: Enhancement request: 'ambiguous' column reference  (Neil Conway <neilc@samurai.com>)
Re: BUG #1540: Enhancement request: 'ambiguous' column reference in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      1540
Logged by:          Richard Neill
Email address:      postgresql@richardneill.org
PostgreSQL version: 8.01
Operating system:   Linux
Description:        Enhancement request: 'ambiguous' column reference in
psql
Details:

Dear Postgresql team,

I have a small suggestion, which isn't quite a bug, but where psql throws an
error which it could in principle recover from. These occur when a column
reference is ambiguous, but isn't really, because of information supplied in
the join.


Here is an example, which I just tested in 8.01.


These are the database tables:
----------------------------------
tbl_instruments:
    instrument    character varying
    priceband    smallint

----------------------------------
tbl_prices:
    priceband    smallint
    pounds        double precision
-----------------------------------


This query fails:
------------------------------------
SELECT instrument,priceband,pounds FROM tbl_instruments,tbl_prices WHERE
tbl_instruments.priceband=tbl_prices.priceband;

ERROR:  column reference "priceband" is ambiguous
-----------------------------------



This query succeeds:
-----------------------------------------
SELECT instrument,tbl_instruments.priceband,pounds FROM
tbl_instruments,tbl_prices WHERE
tbl_instruments.priceband=tbl_prices.priceband;
------------------------------------------


I think that the first query ought to succeed, since although priceband is
ambiguous (it could mean either tbl_prices.priceband or
tbl_instruments.priceband), the information in the WHERE clause means that
they are explicitly equal, and so it doesn't matter which one we use.


Thank you very much for all your work - Postgresql is really useful to me.

Richard

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: ALTER DATABASE ... RENAME: permission denied for superuser
Следующее
От: "John Engelhart"
Дата:
Сообщение: BUG #1541: Unusually long INSERT times after fresh clean/CREATE TABLES