Contents
to_regtype()
A function translating a type name to an OID
to_regtype()
is a system function for translating a data type name to its OID
to_regtype()
was added in PostgreSQL 9.4.
Usage
to_regtype (text
) →regtype
to_regtype()
is equivalent to using the regtype cast, but returns NULL
rather than raising an ERROR
if no matching data type is found.
The current search path is considered when evaluating the provided data type name.
Change history
- PostgreSQL 16
- PostgreSQL 9.4
- added (commit 0886fc6a)
Examples
Basic usage example for to_regtype()
:
postgres=# SELECT to_regtype('int')::oid; to_regtype ------------ 23 (1 row)
References
- PostgreSQL documentation: System Catalog Information Functions
Categories
See also
regtype