select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / SYSTEM INFORMATION FUNCTIONS AND OPERATORS

Parses a string of text, extracts a potential type name from it, and translates that name into a type OID.

Signatures & examples

to_regtype ( text ) → regtype
Parses a string of text, extracts a potential type name from it, and translates that name into a type OID. A syntax error in the string will result in an error; but if the string is a syntactically valid type name that happens not to be found in the catalogs, the result is NULL. A similar result is obtained by casting the string to type regtype (see Section 8.19), except that that will throw error for name not found.
Version history 4
  1. PG 16 → 17changed
  2. PG 15 → 16changed
  3. PG 12 → 13changed
  4. PG 9.3 → 9.4added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source