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

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: tonimueller(dot)unihalle(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9278: Error: SQLSTATE[42702]: Ambiguous column: 7 ERROR: column reference "tid" is ambiguous LINE 8: ...
Date: 2014-02-20 04:25:55
Message-ID: CAB7nPqT3nebj5MXWCXjW_RwByRQ497T-2BgPE-JXfnbR-BYWgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Feb 20, 2014 at 1:49 AM, <tonimueller(dot)unihalle(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Noah Misch 2014-02-20 04:39:40 Re: BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding
Previous Message Tom Lane 2014-02-20 01:22:13 Re: BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding