Re: Array Char/VarChar Size

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Array Char/VarChar Size
Дата
Msg-id 10183.1204310667@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Array Char/VarChar Size  (Kris Jurka <books@ejurka.com>)
Ответы Re: Array Char/VarChar Size  (dmp <danap@ttc-cmc.net>)
Список pgsql-jdbc
Kris Jurka <books@ejurka.com> writes:
> Multi-dimensional array information is not stored.  Every array type may
> be any number of dimensions.  The precision information is not available
> in the information_schema, but it is available in the system catalog
> tables.  See pg_attribute.atttypmod, but it does require some decoding.

Rather than embedding knowledge of typmod encoding in client-side code,
may I suggest using the format_type function?  For example

select format_type(atttypid, atttypmod) from pg_attribute where
attrelid = 'my_table'::regclass and attname = 'my_column';

This will give you back something reasonably standardized, like
"character varying(42)[]".  You'll still need a bit of logic to
extract what you want, but it seems much less likely to break.

            regards, tom lane

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: Bug while retrieving money data type from db
Следующее
От: Josh Berkus
Дата:
Сообщение: Summer of Code Java?