Sergio Lob wrote:
> Precision is the number of total digits in the number. Scale is the
> number of fractional digits.
> For instance, a column defined as NUMERIC(10,3) should return
> precision=10, scale=3.
Yes, I understand that.
> The error only occurs for a column defined as
> NUMERIC (without precision or scale specified). Presumably, there is a
> default precision and scale assigned to the column by postgreSQL, which
> is not -1.
There appears to be no default, which is why we currently return -1.
Scale should default to 0 per the standard, but defaults to whatever the
precision is in PostgreSQL (see the docs for details).
The docs claim an implementation precision limit of 1000, but that
doesn't seem to correspond to the actual implementation -- I can insert
and retrieve 2000 digits NUMERICs (for example) just fine. I can't see
an obvious limit on precision in the backend code. There may be a
theoretical limit somewhere around 2^30 digits, I think (limited by the
backend's memory allocation sanity checks), but I have not tested that.
Given that there is effectively no default, do you have suggestions for
a better value to return?
In response to
pgsql-bugs by date
|Next:||From: Bruce Momjian||Date: 2005-03-23 21:49:38|
|Subject: Re: BUG #1517: SQL interval syntax is accepted by the parser,|
|Previous:||From: Andrew - Supernews||Date: 2005-03-23 21:26:55|
|Subject: Re: BUG #1552: massive performance hit between 7.4 and 8.0.1|