From: | Steve Crawford <scrawford(at)pinpointresearch(dot)com> |
---|---|
To: | "Katka a Daniel Dunajsky" <daniel_katka(at)hotmail(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: How to increase precision? |
Date: | 2003-05-02 22:13:31 |
Message-ID: | 20030502221331.86C2B103C9@polaris.pinpointresearch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
It's assuming INTs and doing int division. Make one a numeric/real or
explicitly cast:
steve=# select 5/2;
?column?
----------
2
(1 row)
steve=# select 5./2;
?column?
----------
2.5
(1 row)
Cheers,
Steve
On Friday 02 May 2003 2:38 pm, Katka a Daniel Dunajsky wrote:
> Hello all,
>
> this is a newbie question:
>
> How to increase the precision of calculations in posgresql?
>
> When I run this query:
>
> select 5/2;
>
> I get:
>
> ?column?
> --------
> 2
>
> It should be 2.5 shouldn't it?
>
> Thank you for your time.
>
> Daniel
>
>
>
>
>
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-05-02 22:32:45 | Re: How to increase precision? |
Previous Message | Kyle | 2003-05-02 22:06:40 | Best way to delete time stamped data? |