Re: [BUGS] BUG #14521: pg_attribute.attndims = 0 for array column

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] BUG #14521: pg_attribute.attndims = 0 for array column
Дата
Msg-id 7447.1485961998@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [BUGS] BUG #14521: pg_attribute.attndims = 0 for array column  (krzysztof.heim@gmail.com)
Список pgsql-bugs
Krzysztof Heim <krzysztof.heim@gmail.com> writes:
> If I may ask, what is then the best way of checking if column is array.

The standard way for C code is to use this macro from lsyscache.h:

#define type_is_array(typid)  (get_element_type(typid) != InvalidOid)

or depending on what you're doing, you might want these semantics:

/* type_is_array_domain accepts both plain arrays and domains over arrays */
#define type_is_array_domain(typid)  (get_base_element_type(typid) != InvalidOid)

or then again, you might just want to check if the type has nonzero
typelem --- that would be the appropriate thing if you want to see
whether the type is subscriptable.

            regards, tom lane


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

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14521: pg_attribute.attndims = 0 for array column
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: [BUGS] Bug in Physical Replication Slots (at least 9.5)?