cast from integer to money

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: cast from integer to money
Date: 2011-03-31 20:27:54
Message-ID: AANLkTi=zbyy2=cq8Wa3K3+=n2ynkR1kdTHECnoruWS_G@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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. Right now:

rhaas=# select 1::money;
ERROR: cannot cast type integer to money
LINE 1: select 1::money;
^
rhaas=# select 1.0::money;
money
-------
$1.00
(1 row)

Does anyone care enough about this to put in the effort to fix it, or
should we just let it go? Does anyone see a reason why we wouldn't
want to do this, if someone's motivated to code it up?

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-03-31 20:31:33 pg_upgrade exit_nicely()
Previous Message Robert Haas 2011-03-31 20:21:50 Re: Bug in autovacuum.c?