pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: Mitch Vincent <mitch@venux.net>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] numeric question..
Date: Sun, 16 Jan 2000 12:35:34 -0500
Message-ID: <20835.948044134@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.21.0001152025360.386-100000@localhost.localdomain>
References: <Pine.LNX.4.21.0001152025360.386-100000@localhost.localdomain>

Peter Eisentraut <peter_e@gmx.net> writes:
> NUMERIC specifies the data type exact numeric, with the decimal precision
> and scale specified by the <precision> and <scale>.
 
> DECIMAL specifies the data type exact numeric, with the decimal scale
> specified by the <scale> and the implementation-defined decimal precision
> equal to or greater than the value of the specified <precision>.

> Up to this day I'm wondering what exactly this means ...

Yeah, I read that too.  I think what it means is that implementors are
allowed to increase the precision (field width) of a DECIMAL field to a
larger value if that's more efficient in their implementation, whereas
NUMERIC must have exactly the specified precision.

For example, if we were to reimplement NUMERIC using radix-10000
arithmetic (four decimal digits per 16-bit integer), then the most
efficient field widths would be multiples of 4.  According to the spec,
we'd be allowed to increase the field width of a DECIMAL field to make
it a multiple of 4, but not the width of a NUMERIC field.

Right now, there is no such implementation advantage in Postgres, so
the two field types are exactly equivalent in our code.

			regards, tom lane



view thread (6+ messages)

Message-ID: <20835.948044134@sss.pgh.pa.us>
Permalink:  ../20835.948044134@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20835.948044134@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, peter_e@gmx.net, mitch@venux.net
  Subject: Re: [SQL] numeric question..
  In-Reply-To: <20835.948044134@sss.pgh.pa.us>
  References: <Pine.LNX.4.21.0001152025360.386-100000@localhost.localdomain> <20835.948044134@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox