Is it guaranteed that name of array types in pg_type system catalog will always be prefixed by underscore or this convention can be changed in future ?
It is not guaranteed today, let alone in the future, that the array type for x will be _x for any x.
Consider:
andrew=# create type _foo as (x int); create type foo as (y text);select typname from pg_type where oid = (select typarray from pg_type where typname = 'foo'); CREATE TYPE CREATE TYPE typname --------- ___foo (1 row)