Scott Hess wrote:
> Sasha Pachev <sasha@stripped> wrote:
> > Balint TOTH wrote:
> > > Is it OK if sum(field) returns NULL if the table has no records? Older
> > > versions (like 3.22.22) returned 0.
> > This is more logical, I think. If this is not what you want, you can do
> > ifnull(sum(field), 0)
> Except insofar as it breaks existing code! Just this weekend this became a
> problem as I tested against 3.22.23 (we were using 3.22.15).
> Is this how SUM() is supposed to work? When I described the problem at the
> office, my colleagues were pretty much amazed that this happened, and think
> it must be a bug. If it's considered a feature, I need to send some emails
If you have too much code that depends on this, and you cannot just
change it in the code, you can change a couple of lines in the sources
of mysql and recompile.