Re: BUG #9278: Error: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ...

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: BUG #9278: Error: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ...
Дата
Msg-id CAB7nPqT3nebj5MXWCXjW_RwByRQ497T-2BgPE-JXfnbR-BYWgA@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #9278: Error: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ...  (tonimueller.unihalle@gmail.com)
Список pgsql-bugs
On Thu, Feb 20, 2014 at 1:49 AM,  <tonimueller.unihalle@gmail.com> wrote:
> SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is
> ambiguous LINE 8: ... taxonomy_term_data_name, taxonomy_term_data_vid, tid,
> taxon... ^

I am not seeing any bug here. This error is usually found because of
some bad naming in queries involving joins like this one:
=# create table aa (tid int);
CREATE TABLE
=# create table bb (tid int);
CREATE TABLE
=# select tid from aa,bb where aa.tid = bb.tid;
ERROR:  42702: column reference "tid" is ambiguous
LINE 1: select tid from aa,bb where aa.tid = bb.tid;
               ^
LOCATION:  colNameToVar, parse_relation.c:612

You should complete the SELECT clause with some alias like that:
=# select aa.tid from aa,bb where aa.tid = bb.tid;
 tid
-----
(0 rows)
Or that:
=# select bb.tid from aa,bb where aa.tid = bb.tid;
 tid
-----
(0 rows)
Regards,
--
Michael

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding
Следующее
От: Noah Misch
Дата:
Сообщение: Re: BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding