Hi John,

> On Aug 6, 2026, at 18:34, John Naylor <[email protected]> wrote:
> 
> I think it would work to restrict to true array types by adding "AND
> e.typarray = t.oid" to the WHERE clause:
> 
> SELECT t.oid FROM pg_catalog.pg_type t
> JOIN pg_catalog.pg_type e ON t.typelem = e.oid
> LEFT JOIN pg_catalog.pg_namespace n ON e.typnamespace = n.oid
> WHERE t.typtype = 'b'
> AND e.typarray = t.oid
> AND ((e.oid >= 10000 AND e.oid < 16384)
>     OR n.nspname = 'information_schema')

That seems reasonable for ordinary associated array types. One caveat
is that a custom variable-length type can use `array_in`/`array_out` and
store an `ArrayType` datum without being the element type's associated
array. `e.typarray = t.oid` would not detect its embedded element OID.
That said, such a type is probably very uncommon and may not need
special handling.

>> Should we add a TAP test for this as well?
> 
> I don't see any existing TAP tests for type checks.

Thanks, good to know.

--
Best regards,
Chengpeng Yan



Reply via email to