From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Igor Korot <ikorot01(at)gmail(dot)com>, Alban Hertroys <haramrae(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Column information |
Date: | 2017-05-04 14:49:34 |
Message-ID: | 7712e49e-4ef4-2f2e-b16c-970bd62f038c@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 05/04/2017 07:29 AM, Tom Lane wrote:
> Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
>> On 05/04/2017 07:00 AM, Tom Lane wrote:
>>> No, certainly not. The radix column says what the units of measurement
>>> are, not that the values in the precision column aren't decimal. So radix
>>> 2 indicates that precision 32 means "32 bits", not "32 decimal digits".
>
>> Alright now I am confused:
>
>> https://www.postgresql.org/docs/9.6/static/infoschema-columns.html
>
>> "numeric_precision cardinal_number
>
>> If data_type identifies a numeric type, this column contains the
>> (declared or implicit) precision of the type for this column. The
>> precision indicates the number of significant digits. It can be
>> expressed in decimal (base 10) or binary (base 2) terms, as specified in
>> the column numeric_precision_radix. For all other data types, this
>> column is null.
>> "
>
> I'm not here to defend the wording in our documentation ;-)
>
> Perhaps this would be clearer if it said "measured in ... digits" rather
> than "expressed in ... terms"?
>
> It should probably also say "identifies a numeric type of restricted
> precision", since for example it'll be null for a column that's
> NUMERIC but has no typmod.
Think I answered my own question. Numeric refers to all the types under:
https://www.postgresql.org/docs/9.6/static/datatype-numeric.html
not just the specific type numeric.
So:
production=# \d projection
....
pot_ct | integer
....
production=# select * from information_schema.columns where table_name
='projection' and column_name='pot_ct';
...
numeric_precision | 32
numeric_precision_radix | 2
numeric_scale | 0
...
Then the output is saying I am looking at a 32 bit integer(int4). If the
table definition had been int8, the output would be:
numeric_precision | 64
numeric_precision_radix | 2
numeric_scale | 0
>
> regards, tom lane
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2017-05-04 14:54:09 | Re: Column information |
Previous Message | Tom Lane | 2017-05-04 14:44:49 | Re: Column information |