db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oystein Grovlen - Sun Norway <Oystein.Grov...@Sun.COM>
Subject Re: Functions in GROUP BY expressions? (related to DERBY-883)
Date Wed, 15 Nov 2006 11:00:06 GMT
Manish Khettry wrote:
 > Hmm strange. I am not sure why this
 >    select avg(i) from t group by sin(i)
 > works but not this,
 >   select avg(i), sin(i) from test group by sin(i);
 > I think its a bug-- both should be disallowed.

Why should they be disallowed?  I agree that in most cases grouping by
non-deterministic functions do not make sense, but I am not sure that
is a reason for disallowing it.  Also, a function that is generally
non-deterministic may be deterministic in a given context.

Theoretically, I do not see why equivalence and non-deterministic
functions are an issue for GROUP BY.  I do not think an implementation
need to execute the function twice if it appears both in the group-by
clause and in the select list.  The value returned when determining
group could be used for the select list also.


View raw message