Re: float formating with xx.00

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: <map(at)inter-resa(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: float formating with xx.00
Date: 2003-07-03 23:26:09
Message-ID: D90A5A6C612A39408103E6ECDD77B8294CDE78@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)inter-resa(dot)com]
> Sent: Thursday, July 03, 2003 1:29 PM
> To: pgsql-general(at)postgresql(dot)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
>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mark 2003-07-04 00:52:13 Re: float formating with xx.00
Previous Message Martin Marques 2003-07-03 23:11:47 Re: LATIN1 encoding