Re: timestamp group by bug???

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: timestamp group by bug???
Дата
Msg-id 10909.1111517639@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: timestamp group by bug???  ("Celia McInnis" <celia@drmath.ca>)
Список pgsql-novice
"Celia McInnis" <celia@drmath.ca> writes:
> By the way, as a novice, I am/was a little surprised at HAVING to do this,
> since both things in the grouping are just simple functions of the same
> underlying table variable mytimestamp.

The parser cannot be expected to understand that they are equivalent
functions though.  As a counterexample imagine that one extracts the
month and the other the day-of-week; grouping by those two cases would
not yield equivalent results.  When they are equivalent, the extra
GROUP BY clause is redundant, but still needed to make the query pass
the parser's spec-driven sanity checking.

> notably, the following works in mysql:

MySQL is hardly a reliable reference for correct SQL behavior ;-).
My guess is that they are simply failing to test that the query has
well-defined grouping behavior at all.

            regards, tom lane

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

Предыдущее
От: Jack Miller
Дата:
Сообщение: dump & create with a cron job
Следующее
От: Tom Lane
Дата:
Сообщение: Re: dump & create with a cron job