Re: [PATCHES] [PATCH] Contrib C source for casting MONEY to INT[248] and FLOAT[48] - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] [PATCH] Contrib C source for casting MONEY to INT[248] and FLOAT[48]
Date
Msg-id 22666.992960418@sss.pgh.pa.us
Whole thread Raw
Responses Re: [PATCHES] [PATCH] Contrib C source for casting MONEY to INT[248] and FLOAT[48]  ("David D. Kilzer" <ddkilzer@lubricants-oil.com>)
List pgsql-hackers
"David D. Kilzer" <ddkilzer@lubricants-oil.com> writes:
> Attached please find a patch to cast (convert) the MONEY type to any one
> of the following types:
>   INT2, INT4, INT8, FLOAT4, FLOAT8

Hmm.  It strikes me as a rather bad idea to introduce implicit casting
of MONEY to all these other types --- I suspect that's going to create
a bunch of parsing ambiguities.

> I wrote this because I needed to convert MONEY to a standard decimal
> value and didn't want to do it on the client in Perl, and I didn't want
> to use a plpgsql function that used string parsing.

Seems like a better answer is to use NUMERIC instead of MONEY in the
first place...

            regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: temp-table-related failure in regression tests
Next
From: Alex Pilosov
Date:
Subject: Re: PlPerl compile failure