blob: 35d1b057088174c18097a90745e3c036efbc4935 [file] [log] [blame]
4.12 Domains
A domain is a set of permissible values. A domain is defined in a schema and is identified by a <domain name> . The purpose of a domain is to constrain the set of valid values that can be stored in a column of a base table by various operations.
A domain definition specifies a data type. It may also specify a <domain constraint> that further restricts the valid values of the domain and a <default clause> that specifies the value to be used in the absence of an explicitly specified value or column default.
A domain is described by a domain descriptor. A domain descriptor includes:
- The name of the domain.
- The data type descriptor of the data type of the domain.
- The value of <default option> , if any, of the domain.
- The domain constraint descriptors of the domain constraints, if any, of the domain.
4.17.3 Domain constraints
A domain constraint is a constraint that is specified for a domain. It is applied to all columns that are based on that domain, and to all values cast to that domain. A domain constraint is described by a domain constraint descriptor. In addition to the components of every constraint descriptor a domain constraint descriptor includes:
- The <search condition> .
A domain constraint is satisfied by SQL-data if and only if, for any table T that has a column named C based on that domain, the specified <search condition> , with each occurrence of VALUE replaced by C, is not False for any row of T. A domain constraint is satisfied by the result of a <cast specification> if and only if the specified <search condition>, with each occurrence of VALUE replaced by that result, is not False.