From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Krzysztof Heim <krzysztof(dot)heim(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgreSQL(dot)org |
Subject: | Re: BUG #14521: pg_attribute.attndims = 0 for array column |
Date: | 2017-02-01 15:13:18 |
Message-ID: | 7447.1485961998@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Krzysztof Heim <krzysztof(dot)heim(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2017-02-01 16:26:03 | Re: Bug in Physical Replication Slots (at least 9.5)? |
Previous Message | Tom Lane | 2017-02-01 14:25:13 | Re: BUG #14521: pg_attribute.attndims = 0 for array column |