pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Python interface and Money?
2+ messages / 1 participants
[nested] [flat]
* Re: Python interface and Money?
@ 2003-02-26 13:53 D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 1 reply; 2+ messages in thread
From: D'Arcy J.M. Cain @ 2003-02-26 13:53 UTC (permalink / raw)
To: Joel Mc Graw <jmcgraw@databill.com>; +Cc: pgsql-interfaces
On Monday 22 October 2001 13:45, Joel Mc Graw wrote:
> I have a table that has a column of type money. A query such as "select
> sum(document_amount) from foo" returns the correct result when executed
> from psql, yet the same query returns the wrong answer (it appears to be
> a rounding issue--something like "1234.9999999999...") when executed
> through PygreSQL. Is there a workaround or a fix?
The problem is that Python doesn't (yet) have a native decimal type and so the
closest thing we can convert to is float. There have been attempts at a
decimal type and at some point I will convert to one of them, hopefully the
same one that Python chooses as a standard.
> While browsing the mailing list for an answer to this problem I found
> several references to the money type being deprecated. Is that the
> problem?
There are people who want to remove it but I still think it serves a useful
purpose. I think that it needs to move to a 64 bit int and handle a lot more
type conversions but I moved some stuff to numeric due to the limits and
found a noticeable slowdown when working with lots of aggregates on it. The
int type is just more efficient. I plan on making a contrib version of the
type before it gets deleted if that is what is decided.
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Python interface and Money?
@ 2003-02-26 13:57 D'Arcy J.M. Cain <darcy@druid.net>
parent: D'Arcy J.M. Cain <darcy@druid.net>
0 siblings, 0 replies; 2+ messages in thread
From: D'Arcy J.M. Cain @ 2003-02-26 13:57 UTC (permalink / raw)
To: Joel Mc Graw <jmcgraw@databill.com>; +Cc: pgsql-interfaces
On Wednesday 26 February 2003 08:53, D'Arcy J.M. Cain wrote:
> On Monday 22 October 2001 13:45, Joel Mc Graw wrote:
Doh! I was sitting in a saved mail folder and thought that I was responding
to a new message. Sorry about that.
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-02-26 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-26 13:53 Re: Python interface and Money? D'Arcy J.M. Cain <darcy@druid.net>
2003-02-26 13:57 ` D'Arcy J.M. Cain <darcy@druid.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox