Skip site navigation (1) Skip section navigation (2)

Re: Precision and scale of numeric column reported as value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Sergio_Lob(at)iwaysoftware(dot)com, pgsql-bugs(at)postgresql(dot)org,Ephraim Spravtsev <Ephraim_Spravtsev(at)ibi(dot)com>
Subject: Re: Precision and scale of numeric column reported as value
Date: 2005-03-23 22:46:42
Message-ID: 15199.1111618002@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Oliver Jowett <oliver(at)opencloud(dot)com> writes:
> There appears to be no default, which is why we currently return -1.

The spec's notion of a "default precision and scale" is that every
numeric column has a specific precision and scale --- ie, is physically
fixed-width --- and everything you store into it will be coerced to that
precision and scale.  Postgres doesn't do it that way, which is why the
notion of a default is a bit meaningless.

> Scale should default to 0 per the standard, but defaults to whatever the 
> precision is in PostgreSQL (see the docs for details).

If you specify a precision only, we do assume scale 0 to go with it.
It's only the case of an unconstrained numeric column that we depart
from the spec for.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Roy BadamiDate: 2005-03-23 22:47:40
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,
Previous:From: Roy BadamiDate: 2005-03-23 22:39:51
Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group