Search Postgresql Archives

Re: Column information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Igor Korot <ikorot01@xxxxxxxxx> 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 given.)

Try something like this:

# select column_name,data_type,numeric_precision,numeric_precision_radix,numeric_scale,character_maximum_length from information_schema.columns where table_name = 'foo';
-[ RECORD 1 ]------------+------------------
column_name              | id
data_type                | integer
numeric_precision        | 32
numeric_precision_radix  | 2
numeric_scale            | 0
character_maximum_length | 
-[ RECORD 2 ]------------+------------------
column_name              | label
data_type                | character varying
numeric_precision        | 
numeric_precision_radix  | 
numeric_scale            | 
character_maximum_length | 50
-[ RECORD 3 ]------------+------------------
column_name              | price
data_type                | numeric
numeric_precision        | 10
numeric_precision_radix  | 10
numeric_scale            | 2
character_maximum_length | 

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux