Re: [GENERAL] Column information

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] Column information
Дата
Msg-id 10820.1493913677@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [GENERAL] Column information  (Igor Korot <ikorot01@gmail.com>)
Список pgsql-general
Igor Korot <ikorot01@gmail.com> 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.columnswhere 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Igor Korot
Дата:
Сообщение: Re: [GENERAL] Column information
Следующее
От: "Feld, Michael (IMS)"
Дата:
Сообщение: [GENERAL] initdb with ignore hidden option