From: | Oliver Jowett <oliver(at)opencloud(dot)com> |
---|---|
To: | Sergio_Lob(at)iwaysoftware(dot)com |
Cc: | 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 21:44:19 |
Message-ID: | 4241E333.2070305@opencloud.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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?
-O
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2005-03-23 21:49:38 | Re: BUG #1517: SQL interval syntax is accepted by the parser, |
Previous Message | Andrew - Supernews | 2005-03-23 21:26:55 | Re: BUG #1552: massive performance hit between 7.4 and 8.0.1 |