Re: BUG #1540: Enhancement request: 'ambiguous' column reference

Поиск
Список
Период
Сортировка
От Richard Neill
Тема Re: BUG #1540: Enhancement request: 'ambiguous' column reference
Дата
Msg-id 42361BC3.2030200@hermes.cam.ac.uk
обсуждение исходный текст
Ответ на Re: BUG #1540: Enhancement request: 'ambiguous' column reference in psql  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Dear Tom and Neil,

Thanks very much for your help, and your explanations. This makes a lot
of sense, and I agree - this bug is definitely invalid.

Best wishes

Richard




Tom Lane wrote:
> "Richard Neill" <postgresql@richardneill.org> writes:
>
>>SELECT instrument,priceband,pounds FROM tbl_instruments,tbl_prices WHERE
>>tbl_instruments.priceband=tbl_prices.priceband;
>
>
>>ERROR:  column reference "priceband" is ambiguous
>
>
>>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.
>
>
> Doing that would be contrary to the SQL specification, AFAICS.
>
> However, you can get the effect you want by writing the query like
>
> SELECT instrument,priceband,pounds FROM
> tbl_instruments JOIN tbl_prices USING (priceband);
>
> which both provides the join condition and logically merges the two
> input columns into just one output column.
>
>             regards, tom lane
>

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

Предыдущее
От: John Engelhart
Дата:
Сообщение: Re: BUG #1541: Unusually long INSERT times after fresh clean/CREATE TABLES
Следующее
От: "Bobby"
Дата:
Сообщение: BUG #1551: You need an import/export feature