pg_basetype ( regtype ) → regtypeReturns the OID of the base type of a domain identified by its type OID. If the argument is the OID of a non-domain type, returns the argument as-is. Returns NULL if the argument is not a valid type OID. If there's a chain of domain dependencies, it will recurse until finding the base type.
pg_basetype('mytext'::regtype) → text