Re: float formating with xx.00 - Mailing list pgsql-general

From Dann Corbit
Subject Re: float formating with xx.00
Date
Msg-id D90A5A6C612A39408103E6ECDD77B8294CDE78@voyager.corporate.connx.com
Whole thread Raw
In response to float formating with xx.00  (Mark <map@inter-resa.com>)
Responses Re: float formating with xx.00
List pgsql-general
connxdatasync=# create table test (foo float);
CREATE
connxdatasync=# insert into test values(1.0);
INSERT 29128 1
connxdatasync=# insert into test values(2.25);
INSERT 29129 1
connxdatasync=# insert into test values(1.27);
INSERT 29130 1
connxdatasync=# insert into test values(1.1);
INSERT 29131 1
connxdatasync=# select * from test;
 foo
------
    1
 2.25
 1.27
  1.1
(4 rows)

connxdatasync=# select foo::numeric(12,2) from test;
 ?column?
----------
     1.00
     2.25
     1.27
     1.10
(4 rows)

But don't do it.  You'll be sorry.  You really, really, really want to
store money as a numeric type.  Otherwise, you might find some surprises
when columns almost never add up exactly.

IMO-YMMV

> -----Original Message-----
> From: Mark [mailto:map@inter-resa.com]
> Sent: Thursday, July 03, 2003 1:29 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] float formating with xx.00
>
>
> Hello,
>
> I am trying to enter 19.00 in a float field... no error but
> the data (select)
> is showing 19  without the "trailing" zeros...  But for
> format and standard
> presentation of money, I need to keep any last zero digit.
>
> How can I do this? I run version 7.1x
> Thanks!
> --
> Mark
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index
> scan if your
>       joining column's datatypes do not match
>

pgsql-general by date:

Previous
From: Martin Marques
Date:
Subject: Re: LATIN1 encoding
Next
From: Mark
Date:
Subject: Re: float formating with xx.00