SELECT n.nspname as "Schema",
       pg_catalog.format_type(t.oid, NULL) AS "Name",
       pg_catalog.obj_description(t.oid, 'pg_type') as "Description"
FROM pg_catalog.pg_type t
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace,
     (SELECT $1 AS cmd) AS cmd
WHERE (t.typrelid = 0
      OR (SELECT c.relkind = 'c'
            FROM pg_catalog.pg_class c
           WHERE c.oid = t.typrelid))
      AND t.typname !~ '^_'
      AND pg_catalog.pg_type_is_visible(t.oid)
ORDER BY 1, 2