summing Decimal returns float instead of Decimal

Bug #760872 reported by Matt Haggard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
New
Undecided
Unassigned

Bug Description

When summing a Decimal, a float is returned instead of a decimal:

store.execute(Select(Sum(Foo.amount))).get_one()[0]

where Foo.amount is a Decimal() and the sqlite amount is numeric(12,2)

Also,

store.find(Foo).sum(Foo.amount)

raises an exception

Revision history for this message
Matt Haggard (iffy) wrote :
Revision history for this message
Matt Haggard (iffy) wrote :

I'm not sure I like the test_select_decimal test I made. It's a little specific -- I mean, shouldn't I test all types, not just the Decimal type with the Sum function?

Revision history for this message
Matt Haggard (iffy) wrote :

Hmm... so part of the problem is with sqlite. Sqlite returns a float where postgres returns a Decimal.

Revision history for this message
Matt Haggard (iffy) wrote :

This fixes test_find_sum_decimal for sqlite -- I have not tested any other db

test_select_decimal is still not fixed, nor do I know if it can accurately be fixed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.