pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Casting Money To Numeric
2+ messages / 2 participants
[nested] [flat]

* Casting Money To Numeric
@ 2002-11-26 19:19 Thomas Good <tomg@sqlclinic.net>
  2002-11-27 12:51 ` Re: Casting Money To Numeric D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Thomas Good @ 2002-11-26 19:19 UTC (permalink / raw)
  To: pgsql-sql

Hi All.

Having perused all the online docs I can find it appears there is no
SQL solution for casting the dread money type to numeric.
Is this true?

select rent::numeric(9,2) from x;
ERROR: Cannot cast type 'money' to 'numeric'

I guess my cash ain't nothing but trash...  ;-)

TIA!
-----------------------------------------------------------------------
Thomas Good                                  e-mail: tomg@sqlclinic.net
Programmer/Analyst                           phone:   (+1) 718.818.5528
Residential Services                         fax:     (+1) 718.818.5056
Behavioral Health Services, SVCMC-NY         mobile:  (+1) 917.282.7359

    --            Geistiges Eigentum ist Diebstahl!              --




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Casting Money To Numeric
  2002-11-26 19:19 Casting Money To Numeric Thomas Good <tomg@sqlclinic.net>
@ 2002-11-27 12:51 ` D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 0 replies; 2+ messages in thread

From: D'Arcy J.M. Cain @ 2002-11-27 12:51 UTC (permalink / raw)
  To: Thomas Good <tomg@sqlclinic.net>; pgsql-sql

On November 26, 2002 02:19 pm, Thomas Good wrote:
> Having perused all the online docs I can find it appears there is no
> SQL solution for casting the dread money type to numeric.
> Is this true?
>
> select rent::numeric(9,2) from x;
> ERROR: Cannot cast type 'money' to 'numeric'

Fraid so.  That's one of the reasons that I had to finally leave that type 
for numeric.  Be prepared, however, for SUM() to take longer on groups of any 
significant size.  That's the one thing that was really nice about money - 
everything was integer arithmetic.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-11-27 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-26 19:19 Casting Money To Numeric Thomas Good <tomg@sqlclinic.net>
2002-11-27 12:51 ` D'Arcy J.M. Cain <darcy@druid.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox