DOMAIN (PostgreSQL)
DOMAIN (PostgreSQL) is a SQL data type in the PostgreSQL Specific category. PostgreSQL: creates a reusable custom type with constraints. Like a type alias with validation. The syntax is CREATE DOMAIN domain_name AS base_type [CONSTRAINT name CHECK (condition)];. It returns domain type. A typical example: CREATE DOMAIN us_phone AS TEXT CHECK (VALUE ~ '^\d{3}-\d{3}-\d{4}