Skip site navigation (1) Skip section navigation (2)

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

From: Richard Neill <rn214(at)hermes(dot)cam(dot)ac(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Neill <postgresql(at)richardneill(dot)org>,pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1540: Enhancement request: 'ambiguous' column reference
Date: 2005-03-14 23:18:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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


Tom Lane wrote:
> "Richard Neill" <postgresql(at)richardneill(dot)org> writes:
>>SELECT instrument,priceband,pounds FROM tbl_instruments,tbl_prices WHERE
>>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

In response to

pgsql-bugs by date

Next:From: Jason EricksonDate: 2005-03-15 05:53:12
Subject: BUG #1545: LIBPQ Windows Version not calling WSACleanup for every WSAStartup
Previous:From: Tom LaneDate: 2005-03-14 18:39:59
Subject: Re: BUG #1542: pg_dump seg fault

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group