RE: ambiguous - Mailing list pgsql-general

From Riebs, Andy
Subject RE: ambiguous
Date
Msg-id F65B33CAD23A284EAE6E4AE353BF94DC0C25B5@tayexc13.americas.cpqcorp.net
Whole thread Raw
In response to ambiguous  (si <s@remail.net>)
List pgsql-general
> select * from DEPARTMENT, Employee where dept_no = '1';
>
> PG throws up:
> ERROR:  Column 'dept_no' is ambiguous
>
> Is this not allowed? or is my sql understanding wrong?

While a human can determine that it doesn't matter if you use
DEPARTMENT.dept_no or Employee.dept_no in this query, it would
require an extremely talented parser to recognize that.

What you probably want is something like

  select * from DEPARTMENT, Employee where DEPARTMENT.dept_no=1
  and DEPARTMENT.dept_no=Employee.dept_no;

/andy

---
Andy Riebs, andy.riebs@compaq.com      Alpha Technology Solutions Group
978-506-6628, fax 978-506-6524         Compaq Computer Corporation
(h) ariebs@earthlink.net               <http://www.linuxalpha.compaq.com>
<http://osdb.sourceforge.net/>

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why are tables sizes so big?
Next
From: "Brett W. McCoy"
Date:
Subject: Re: ambiguous