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 its type modifier, if any.

Signatures & examples

to_regtypemod ( text ) → integer
Parses a string of text, extracts a potential type name from it, and translates its type modifier, if any. 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. The result is -1 if no type modifier is present.
format_type(to_regtype('varchar(32)'), to_regtypemod('varchar(32)')) → character varying(32)
Version history 1
  1. PG 16 → 17added

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