The syntax documented below is referenced from other parts of this language reference.
The scalar data types are simple data types that hold a single value. For reasons of organisation, the syntax of BLOB types are defined separately in .
Scalar Data Types Syntax
Table 3.12.1.1 Arguments for the Scalar Data Types Syntax
3.12.1.1 Use of Domains in Declarations
A domain name can be specified as the type of a PSQL parameter or local variable. The parameter or variable will inherit all domain attributes. If a default value is specified for the parameter or variable, it overrides the default value specified in the domain definition.
If the TYPE OF
clause is added before the domain name, only the data type of the domain is used: any of the other attributes of the domain — NOT NULL
constraint, CHECK
constraints, default value — are neither checked nor used. However, if the domain is of a text type, its character set and collation sequence are always used.
3.12.1.2 Use of Column Type in Declarations
Input and output parameters or local variables can also be declared using the data type of columns in existing tables and views. The clause is used for that, specifying relationname.columnname as its argument.
When TYPE OF COLUMN
is used, the parameter or variable inherits only the data type and — for string types — the character set and collation sequence. The constraints and default value of the column are ignored.
The BLOB data types hold binary, character or custom format data of unspecified size. For more information, see Section 3.7, Binary Data Types.
BLOB Data Types Syntax
Table 3.12.2.1 Arguments for the Blob Data Types Syntax
The array data types hold multiple scalar values in a single or multi-dimensional array. For more information, see
Array Data Types Syntax
Table 3.12.3.1 Arguments for the Array Data Types Syntax