From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] Open 6.5 items |
Date: | 1999-05-19 20:40:27 |
Message-ID: | 999.927146427@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> That is an excellent point. GROUP BY has to use a column name, and they
> have to be unique, while WHERE does not require stuff to be in the
> target list, so there is a change of ambiguity. I am going to remove
> the item from the list.
Good point --- consider this:
SELECT a, b AS a FROM tt GROUP BY a;
We do get it right: "ERROR: GROUP BY 'a' is ambiguous".
Whereas in
SELECT a, b AS a FROM tt WHERE a = 1;
the WHERE clause is taken as referring to the "real" column a.
So, unless there's some violation of spec behavior here, there is a
reason for GROUP BY to behave differently from WHERE. I think I was
the one who complained that they were different --- I withdraw the
complaint.
BTW, which behavior should ORDER BY exhibit? I find that
SELECT a, b AS a FROM tt ORDER BY a;
is accepted and 'a' is taken to be the real column a. Considering that
ORDER BY is otherwise much like GROUP BY, I wonder whether it shouldn't
complain that 'a' is ambiguous...
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Charles Tassell | 1999-05-19 20:48:48 | Re: [GENERAL] Looking for Mr. Autonum |
Previous Message | E Westfield | 1999-05-19 20:07:03 | Looking for Mr. Autonum |