X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 9965330EFC2; Tue, 17 Jun 2003 14:29:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 29575-10; Tue, 17 Jun 2003 11:29:16 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id E2E5530F0BD; Tue, 17 Jun 2003 11:29:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h5HET7U6012551; Tue, 17 Jun 2003 10:29:07 -0400 (EDT) To: shridhar_daithankar@persistent.co.in Cc: pgsql-hackers@postgresql.org, pgsql-sql@postgresql.org Subject: Re: [HACKERS] Our FLOAT(p) precision does not conform to spec In-reply-to: <3EEF0AF4.16718.1AEA03@localhost> References: <3EEF0AF4.16718.1AEA03@localhost> Comments: In-reply-to "Shridhar Daithankar" message dated "Tue, 17 Jun 2003 12:35:00 +0530" Date: Tue, 17 Jun 2003 10:29:07 -0400 Message-ID: <12550.1055860147@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200306/180 X-Sequence-Number: 13938 "Shridhar Daithankar" writes: > On 16 Jun 2003 at 18:15, Tom Lane wrote: >> This is a straightforward change and would not break pg_dump files, >> since fortunately pg_dump always references the underlying types and >> never refers to anything as FLOAT(p). But I wonder whether it is >> likely to break many existing applications. There is a hazard of some >> existing app asking for (what it thinks is) float8 and getting float4 >> instead. > I hate the syntax of putting decimal digits as range checkers in SQL > field. But oracle does that and consequently lot of oracle apps rely > on it. I won't be surprised if float(p) notion brings same assurance > to such app developers. You are confusing NUMERIC --- which does allow exact precision limits to be specified --- with FLOAT, which does no such thing. It has never been the case in Postgres that FLOAT(p) would restrict you to exactly p digits. The underlying implementation is that there are just two kinds of float (single and double precision) and you get whichever can hold at least p digits. This is per spec, which states that you get at least p digits, not exactly p digits. Our only problem is that whoever wrote that code failed to notice that p is supposed to be measured differently for FLOAT than for NUMERIC. AFAICT, other databases get this right (at least Oracle and DB2 do), so expectations of developers are more likely to be that we conform to the spec than that we don't. regards, tom lane