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

Re: No migration path for MONEY

From: Darcy Buskermolen <darcy(at)wavefire(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: No migration path for MONEY
Date: 2003-01-29 16:41:09
Message-ID: 200301290841.09474.darcy@wavefire.com (view raw or flat)
Thread:
Lists: pgsql-bugs
The problem here is not that we are getting rid of MONEY as datatype, (I see 
no need for it with having numeric) the problem comes from haveing no way to 
migrate MONEY to NUMERIC short of hand editing  the pgdump file and then 
reimporting.  Yes I know I can use sed, but that is not the point.  In 7.1 
and prior I could do a SELECT '1.0'::MONEY::TEXT or  to NUMERIC or to FLOAT 
even. 

On Monday 27 January 2003 12:06, Bruce Momjian wrote:
> They are probably better off just changing the column data type, _and_
> we need someone to get MONEY working as an extented NUMERIC type.
>
> ---------------------------------------------------------------------------
>
> Josh Berkus wrote:
> > 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
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org

-- 
Darcy Buskermolen
Wavefire Technologies Corp.
ph: 250.717.0200
fx:  250.763.1759
http://www.wavefire.com

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2003-01-29 17:04:38
Subject: Re: No migration path for MONEY
Previous:From: tomasDate: 2003-01-29 13:14:02
Subject: Re: [pgsql-bugs] Daily Digest V1 #784

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