Skip site navigation (1) Skip section navigation (2)

Re: cast from integer to money

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: cast from integer to money
Date: 2011-03-31 21:30:26
Message-ID: AANLkTimVj+zHpSTmpAe7myvSxMxHy3w8j-bttUXyY0=S@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Thu, Mar 31, 2011 at 4:58 PM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On the open items list, we have:
>>
>> conversion from integer literals to money type
>> http://archives.postgresql.org/pgsql-testers/2011-01/msg00000.php
>>
>> What this is really complaining about is that we added a cast from
>> numeric to money, but not from integer to money.  This isn't
>> really a bug: the fact that we added one cast doesn't oblige us to
>> add two. On the other hand, the change is probably harmless and
>> straightforward, and might reduce user confusion.
>
> There were reasonable arguments made why this could be a bad idea --
> primarily around the question of whether '395' represented $3.95 or
> $395.00.

That's not too hard to figure out, right?  If 1.00 means $1.00, 1 had
better not mean $0.01, or there will be riots in the streets.

> Going the other way has issues with truncation of
> fractions and the number of digits which can be handled.

Notice I didn't propose that.

> I'm not
> convinced it's sane, and I feel strongly it's too late in the cycle
> to try to implement.

Fair enough.  Any contrary votes?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-03-31 21:33:38
Subject: Re: Bug in autovacuum.c?
Previous:From: Alexey KlyukinDate: 2011-03-31 21:08:17
Subject: Re: proposal: a validator for configuration files

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group