Re: [GENERAL] Column information

2017-05-04 Thread Tom Lane
Igor Korot writes: > So if I write for example: > CREATE TABLE foo(id INTEGER PRIMARY KEY, label VARCHAR(50), price > DOUBLE(10, 2)); > how can I get 50, 10 and 2 from those 5 fields? (I assume you meant NUMERIC where you wrote DOUBLE, because that's not valid syntax as

Re: [GENERAL] Column information

2017-05-04 Thread Igor Korot
David et al, On Thu, May 4, 2017 at 11:27 AM, David G. Johnston wrote: > On Thu, May 4, 2017 at 8:08 AM, Igor Korot wrote: >> >> Hi, guys, >> >> On Thu, May 4, 2017 at 10:54 AM, Adrian Klaver >> wrote: >> > On

Re: [GENERAL] Column information

2017-05-04 Thread Tom Lane
Adrian Klaver writes: > 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. Right. This overloading of the term "numeric" is a bit

Re: [GENERAL] Column information

2017-05-04 Thread David G. Johnston
On Thu, May 4, 2017 at 8:08 AM, Igor Korot wrote: > Hi, guys, > > On Thu, May 4, 2017 at 10:54 AM, Adrian Klaver > wrote: > > On 05/04/2017 07:44 AM, Tom Lane wrote: > >> > >> Adrian Klaver writes: > >>> > >>> Alright I

Re: [GENERAL] Column information

2017-05-04 Thread Igor Korot
Hi, guys, On Thu, May 4, 2017 at 10:54 AM, Adrian Klaver wrote: > On 05/04/2017 07:44 AM, Tom Lane wrote: >> >> Adrian Klaver writes: >>> >>> Alright I see that, but why does my example show a >>> numeric_precision_radix of 10? >> >> >>> Is

Re: [GENERAL] Column information

2017-05-04 Thread Adrian Klaver
On 05/04/2017 07:44 AM, Tom Lane wrote: Adrian Klaver writes: Alright I see that, but why does my example show a numeric_precision_radix of 10? Is there some transition point where it goes from base 10 to base 2? In PG, "numeric" always has radix 10, because the

Re: [GENERAL] Column information

2017-05-04 Thread Adrian Klaver
On 05/04/2017 07:29 AM, Tom Lane wrote: Adrian Klaver 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

Re: [GENERAL] Column information

2017-05-04 Thread Tom Lane
Adrian Klaver writes: > Alright I see that, but why does my example show a > numeric_precision_radix of 10? > Is there some transition point where it goes from base 10 to base 2? In PG, "numeric" always has radix 10, because the underlying implementation is decimal,

Re: [GENERAL] Column information

2017-05-04 Thread Adrian Klaver
On 05/04/2017 07:29 AM, Tom Lane wrote: Adrian Klaver 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

Re: [GENERAL] Column information

2017-05-04 Thread Tom Lane
Adrian Klaver 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

Re: [GENERAL] Column information

2017-05-04 Thread Adrian Klaver
On 05/04/2017 07:00 AM, Tom Lane wrote: Igor Korot writes: Yes, so for the Radix 2 only 0 and 1 should be used, right? And so the value should be 10 and not 32. No, certainly not. The radix column says what the units of measurement are, not that the values in the

Re: [GENERAL] Column information

2017-05-04 Thread Adrian Klaver
On 05/03/2017 08:18 PM, Igor Korot wrote: Hi, ALL, One more question if I may. [code] draft=# SELECT * FROM information_schema.columns WHERE table_name = 'leagues' AND ordinal_position = 8; table_catalog | table_schema | table_name | column_name | ordinal_position | column_default |

Re: [GENERAL] Column information

2017-05-04 Thread Tom Lane
Igor Korot writes: > Yes, so for the Radix 2 only 0 and 1 should be used, right? > And so the value should be 10 and not 32. 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

Re: [GENERAL] Column information

2017-05-04 Thread Igor Korot
Hi, Alan, On Thu, May 4, 2017 at 3:18 AM, Alban Hertroys wrote: > >> According to the documentation 'numeric_precision_radix' field should >> indicate what radix the value of 'numeric_precision' is stored. >> >> However, even though the radix is 2, the actual value is 32,

Re: [GENERAL] Column information

2017-05-04 Thread Alban Hertroys
> According to the documentation 'numeric_precision_radix' field should > indicate what radix the value of 'numeric_precision' is stored. > > However, even though the radix is 2, the actual value is 32, which is > not a radix 2. https://en.wikipedia.org/wiki/Radix Alban Hertroys -- If you

[GENERAL] Column information

2017-05-03 Thread Igor Korot
Hi, ALL, One more question if I may. [code] draft=# SELECT * FROM information_schema.columns WHERE table_name = 'leagues' AND ordinal_position = 8; table_catalog | table_schema | table_name | column_name | ordinal_position | column_default | is_nullable | data_type | character_maximum_length |