33.18. domains

The view domains contains all domains defined in the current database.

Table 33-16. domains Columns

NameData TypeDescription
domain_catalogsql_identifierName of the database that contains the domain (always the current database)
domain_schemasql_identifierName of the schema that contains the domain
domain_namesql_identifierName of the domain
data_typecharacter_data Data type of the domain, if it is a built-in type, or ARRAY if it is some array (in that case, see the view element_types), else USER-DEFINED (in that case, the type is identified in udt_name and associated columns).
character_maximum_lengthcardinal_number If the domain has a character or bit string type, the declared maximum length; null for all other data types or if no maximum length was declared.
character_octet_lengthcardinal_number If the domain has a character type, the maximum possible length in octets (bytes) of a datum (this should not be of concern to PostgreSQL users); null for all other data types.
character_set_catalogsql_identifierApplies to a feature not available in PostgreSQL
character_set_schemasql_identifierApplies to a feature not available in PostgreSQL
character_set_namesql_identifierApplies to a feature not available in PostgreSQL
collation_catalogsql_identifierApplies to a feature not available in PostgreSQL
collation_schemasql_identifierApplies to a feature not available in PostgreSQL
collation_namesql_identifierApplies to a feature not available in PostgreSQL
numeric_precisioncardinal_number If the domain has a numeric type, this column contains the (declared or implicit) precision of the type for this domain. The precision indicates the number of significant digits. It can be expressed in decimal (base 10) or binary (base 2) terms, as specified in the column numeric_precision_radix. For all other data types, this column is null.
numeric_precision_radixcardinal_number If the domain has a numeric type, this column indicates in which base the values in the columns numeric_precision and numeric_scale are expressed. The value is either 2 or 10. For all other data types, this column is null.
numeric_scalecardinal_number If the domain has an exact numeric type, this column contains the (declared or implicit) scale of the type for this domain. The scale indicates the number of significant digits to the right of the decimal point. It can be expressed in decimal (base 10) or binary (base 2) terms, as specified in the column numeric_precision_radix. For all other data types, this column is null.
datetime_precisioncardinal_number If data_type identifies a date, time, timestamp, or interval type, this column contains the (declared or implicit) fractional seconds precision of the type for this domain, that is, the number of decimal digits maintained following the decimal point in the seconds value. For all other data types, this column is null.
interval_typecharacter_dataNot yet implemented
interval_precisioncharacter_dataNot yet implemented
domain_defaultcharacter_dataDefault expression of the domain
udt_catalogsql_identifierName of the database that the domain data type is defined in (always the current database)
udt_schemasql_identifierName of the schema that the domain data type is defined in
udt_namesql_identifierName of the domain data type
scope_catalogsql_identifierApplies to a feature not available in PostgreSQL
scope_schemasql_identifierApplies to a feature not available in PostgreSQL
scope_namesql_identifierApplies to a feature not available in PostgreSQL
maximum_cardinalitycardinal_numberAlways null, because arrays always have unlimited maximum cardinality in PostgreSQL
dtd_identifiersql_identifier An identifier of the data type descriptor of the domain, unique among the data type descriptors pertaining to the domain (which is trivial, because a domain only contains one data type descriptor). This is mainly useful for joining with other instances of such identifiers. (The specific format of the identifier is not defined and not guaranteed to remain the same in future versions.)