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.

--
Øystein

Reply via email to