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