Skip site navigation (1) Skip section navigation (2)

Re: timestamp group by bug???

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Celia McInnis" <celia(at)drmath(dot)ca>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: timestamp group by bug???
Date: 2005-03-22 18:53:59
Message-ID: 10909.1111517639@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"Celia McInnis" <celia(at)drmath(dot)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

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2005-03-22 19:17:39
Subject: Re: dump & create with a cron job
Previous:From: Jack MillerDate: 2005-03-22 18:48:10
Subject: dump & create with a cron job

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group