From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Suggested (or existing) way to parse currency into numeric? |
Date: | 2015-06-12 17:29:18 |
Message-ID: | CAKFQuwYQMU6OZxn04V_n3+qHq6ofxNhSiqv09YUPJo6i51t5gA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
>
>
>> I wrote that type off as something I would never code into my own
>> schema so basically forgot about its usability in other situations.
>>
>
> Though if you do not want to use the money type in a table you could do:
>
> test=> select '$18,665'::money::numeric;
> numeric
> ----------
> 18665.00
> (1 row)
>
>
Except I have to define the table with money so that json_populate_record
uses the correct cast. But yes, when actually using the data, or if I
decide to make a view on top of the table, I can cast from money to numeric.
I guess I could define a custom type using money and then define the table
using numeric and transform in between; but its yet another definition to
keep in sync.
Money perfectly meets my current need and no longer has my scorn.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Francisco Olarte | 2015-06-12 17:45:44 | Re: double precision[] storage space questions |
Previous Message | Adrian Klaver | 2015-06-12 17:16:38 | Re: Suggested (or existing) way to parse currency into numeric? |