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

No migration path for MONEY

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: No migration path for MONEY
Date: 2003-01-24 19:12:01
Message-ID: 200301241112.01170.josh@agliodbs.com (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-bugs
Folks,

Bug reported off IRC:

MONEY Type cannot be cast to any other type, preventing migration from this 
depreciated data type.

Affects: 7.2.3, 7.3.1
Frequency:  100% Reproducable
Effect When Occurring:   Unable to convert, query data
Difficulty of Fix:  Easy, probably
Certianty of Diagnosis:  100%

On both 7.2.3 and 7.3.1 all of the following statements will fail:

select cast('40.00'::MONEY as NUMERIC);
select cast('40.00'::MONEY as DOUBLE);
select cast('40.00'::MONEY as VARCHAR);
select "numeric"('40.00'::MONEY);
select to_char('40.00'::MONEY, '99999999999.9999');

This means that someone who has inherited or upgarded a 6.5 database with 
MONEY columns has no way to migrate them to NUMERIC columns other than an 
external language script or dump and reload from COPY file.   

I propose that we need to restore the CAST(MONEY AS NUMERIC) function so that 
users can migrate old databases to the new data type.   In later versions of 
postgres, I suggest that MONEY be abandoned as a true data type and instead 
become a DOMAIN of NUMERIC for those converting.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2003-01-24 20:50:43
Subject: Re: Bug #885: Trouble with timestamps after vacuuming
Previous:From: pgsql-bugsDate: 2003-01-24 19:07:53
Subject: Bug #885: Trouble with timestamps after vacuuming

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