Re: [HACKERS] Open 6.5 items

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Open 6.5 items
Дата
Msg-id 999.927146427@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Open 6.5 items  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.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 inSELECT 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 thatSELECT 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


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

Предыдущее
От: "E Westfield"
Дата:
Сообщение: Looking for Mr. Autonum
Следующее
От: Charles Tassell
Дата:
Сообщение: Re: [GENERAL] Looking for Mr. Autonum