Currently, trying to cast from a type id to a type name via ::regtype does not work if the type is user-defined.
Repro:
demo@127.0.0.1:26257/defaultdb> create type t as enum('a', 'b');
CREATE TYPE
Time: 6ms total (execution 6ms / network 0ms)
demo@127.0.0.1:26257/defaultdb> select oid::regtype from pg_type where typname = 't';
oid
----------
100052
(1 row)
Time: 5ms total (execution 4ms / network 0ms)
demo@127.0.0.1:26257/defaultdb>
This should return t, not 100052.
Currently, trying to cast from a type id to a type name via
::regtypedoes not work if the type is user-defined.Repro:
This should return
t, not100052.