PostgreSQL assigns the type of SUM to be the type of the column it is
aggregating over. Physmessage.messagesize is INT8, so there we go: we're
only getting a 32 bit signed value as the sum.

I'll add an appropriate type cast to the sql fragments in db_get_sql for
dbpgsql.c, a dummy in dbmysql.c, and look up how SQLite handles this
data type issue.

There are actually five places in db.c where a sum is taken over
physmessage.messagesize, but I think the only negative effect is to
disable quota checks on mailboxes above 2GB.

Aaron

On Thu, 2007-02-15 at 23:54 -0800, Aaron Stone wrote:
> http://www.linuxforums.org/forum/linux-programming-scripting/54312-postgresql-sum-overflow-error.html
> 
> You're on PostgreSQL, right? I wonder if someone has narrowed this
> report down to either a bug or a subtlty of the column type?
> 
> Aaron
> 
> On Thu, 2007-02-15 at 13:21 -0500, Matthew T. O'Connor wrote:
> > Unfortunately in the interim I have deleted a lot of messages from my 
> > account and now after I run dbmail-util the curmail_size value is again 
> > positive.  I assume this is because I now have less than 2G in the 
> > matthew account.  So I do think there is an issue here somewhere, sorry 
> > I'm not able to help more at the moment.
> > 
> > Matt
> > 
> > 
> > Paul J Stevens wrote:
> > > Running 'dbmail-util -py' at trace_level=5 should reveal what's going on
> > > here.
> > > 
> > > Aaron Stone wrote:
> > >> On Mon, 2007-02-12 at 00:29 -0500, Matthew T. O'Connor wrote:
> > >>> I was looking at dbmail_users today and noticed this:
> > >>>
> > >>>  user_idnr |             userid             | curmail_size
> > >>> -----------+--------------------------------+--------------
> > >>>          4 | matthew                        |  -1886517308
> > >> That's interesting (to say the least :-P). Internally we've got a u64_t;
> > >> I wonder if that's just coming into DBMail as a high 64 bit number or if
> > >> something is really screwed up.
> > >>
> > >> Aaron
> > >>
> > >> _______________________________________________
> > >> Dbmail-dev mailing list
> > >> [email protected]
> > >> http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> > >>
> > > 
> >     
> > _______________________________________________
> > Dbmail-dev mailing list
> > [email protected]
> > http://twister.fastxs.net/mailman/listinfo/dbmail-dev
> 
> _______________________________________________
> Dbmail-dev mailing list
> [email protected]
> http://twister.fastxs.net/mailman/listinfo/dbmail-dev

_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to