Re: How to use the postgresql money type?

From: "A(dot)M(dot)" <agentm(at)themactionfaction(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Re: How to use the postgresql money type?
Date: 2011-01-20 15:50:16
Message-ID: 2AFC89AC-2F73-4D7D-A42A-004E89BB05C3@themactionfaction.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg


On Jan 20, 2011, at 10:45 AM, Federico Di Gregorio wrote:

> On 20/01/2011 16:40, A.M. wrote:
>>
>
> But this makes sense. Do you mean that banker's rounding may depend on
> the locale? If that's the case and if PostgreSQL implements such
> gimmicks then the correct default for money would be to return it to
> Python as string and let the user decide how to proceed from there.

Banker's rounding doesn't occur at all by default with the money type since it doesn't represent values outside it's locale-dependent scale, but any real->money conversion must occur in the database to account for this possibility.

> the type should effectively
> be treated as an opaque text value

is what I wrote above. Python can't really do anything with the value other than to display it.

Cheers,
M

In response to

Browse psycopg by date

  From Date Subject
Next Message Adrian Klaver 2011-01-20 15:58:19 Re: How to use the postgresql money type?
Previous Message Federico Di Gregorio 2011-01-20 15:45:30 Re: How to use the postgresql money type?