Skip to content

Domain

Creates a user-defined data type with optional constraints.

Properties

Property Type Required Description
name string The name of the domain function to create.
schema string The schema to create the domain function in.
owner string The role that owns the domain function.
sql string User-provided raw SQL snippet.
data_type string The underlying data type of the domain.
collation string An optional collation for the domain. If no collation is specified, the underlying data type's default collation is used. The underlying type must be collatable if COLLATE is specified.
default boolean | integer | null | number | string The DEFAULT clause specifies a default value for columns of the domain data type. The value is any variable-free expression (but subqueries are not allowed). The data type of the default expression must match the data type of the domain. If no default value is specified, then the default value is the null value.
check_constraints array of object An array of one or more check constraints. Entries must be unique.
comment string An optional comment about the domain.
dependencies dependencies Database objects this object is dependent upon.

check_constraints[]

Property Type Required Description
name string Constraint Name.
nullable boolean Domain is Nullable.
expression string Constraint Expression.

Mutually exclusive forms

Exactly one of these must hold:

  • expression, without nullable
  • nullable, without expression

Mutually exclusive forms

Exactly one of these must hold:

  • sql, without data_type or check_constraints
  • data_type, without sql

No other properties are accepted.


Source: schemata/domain.yml · Resolved JSON Schema: domain.json