X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4CD77476485 for ; Fri, 2 May 2003 18:13:38 -0400 (EDT) Received: from polaris.pinpointresearch.com (66-7-238-176.cust.telepacific.net [66.7.238.176]) by postgresql.org (Postfix) with ESMTP id 4FB5D476478 for ; Fri, 2 May 2003 18:13:35 -0400 (EDT) Received: from there (66-7-238-179.cust.telepacific.net [66.7.238.179]) by polaris.pinpointresearch.com (Postfix) with SMTP id 86C2B103C9; Fri, 2 May 2003 15:13:31 -0700 (PDT) Content-Type: text/plain; charset="iso-8859-1" From: Steve Crawford Organization: Pinpoint Research To: "Katka a Daniel Dunajsky" , pgsql-sql@postgresql.org Subject: Re: How to increase precision? Date: Fri, 2 May 2003 14:13:31 -0800 X-Mailer: KMail [version 1.3.1] References: In-Reply-To: MIME-Version: 1.0 Message-Id: <20030502221331.86C2B103C9@polaris.pinpointresearch.com> Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, hits=-32.5 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/35 X-Sequence-Number: 13200 It's assuming INTs and doing int division. Make one a numeric/real or=20 explicitly cast: steve=3D# select 5/2; ?column?=20 ---------- 2 (1 row) steve=3D# select 5./2; ?column?=20 ---------- 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=3Dfeatures/junkmail > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster