Re: timestamp group by bug??? - Mailing list pgsql-novice

From Tom Lane
Subject Re: timestamp group by bug???
Date
Msg-id 10909.1111517639@sss.pgh.pa.us
Whole thread Raw
In response to Re: timestamp group by bug???  ("Celia McInnis" <celia@drmath.ca>)
List 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 by date:

Previous
From: Jack Miller
Date:
Subject: dump & create with a cron job
Next
From: Tom Lane
Date:
Subject: Re: dump & create with a cron job