CREATE DOMAIN

A DDL command for defining a domain

CREATE DOMAIN is a DDL command for defining a domain.

CREATE DOMAIN was added in PostgreSQL 7.3.

Change history

Examples

Create a domain:

postgres=# CREATE DOMAIN git_sha1 AS
  CHAR(40) NOT NULL
  CHECK (VALUE ~ '^[0-9a-fA-F]+$');
CREATE DOMAIN

This, as the name implies, defines a domain suitable for storing a GIT sha1 tag.

Categories

Data type, DDL, SQL command

See also

ALTER DOMAIN, DROP DOMAIN