| From: | "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> |
|---|---|
| To: | "Stefan Schwarzer" <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: How to avoid: 9.50184e+06 |
| Date: | 2007-09-28 14:16:08 |
| Message-ID: | dcc563d10709280716k798f30d6g7a1f1079659fc46d@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On 9/28/07, Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch> wrote:
> Hi there,
>
> how can I avoid results like this: 9.50184e+06
>
> Instead it should return the "real" value, as 950184.
>
> Thanks for any hints!
Cast it to numeric:
select 9.50184e+06::real::numeric;
But know that you're losing accuracy if you're working with real / float types.
If you need all the parts of the number kept around, use numeric from the start.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2007-09-28 14:23:41 | Re: access privileges: grant select on (all current and future tables)? |
| Previous Message | John Smith | 2007-09-28 14:07:23 | Re: access privileges: grant select on (all current and future tables)? |