PostgreSQL

Скачать в pdf «PostgreSQL»


NULL clause


The NULL «constraint» (actually a non-constraint) is a Postgres extension to SQL92 is included for symmetry with the NOT NULL clause. Since it is the default for any column, its presence is simply noise. [ CONSTRAINT name ] NULL not NULL clause


SQL92 specifies some additional capabilities for NOT NULL:


[ CONSTRAINT name ] NOT NULL [ { INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ [ NOT ] DEFERRABLE ]


CONSTRAINT clause


SQL92 specifies some additional capabilities for constraints, and also defines assertions and domain constraints. Note: Postgres does not yet support either domains or assertions.


An assertion is a special type of integrity constraint and shares the same namespace as other constraints. However, an assertion is not necessarily dependent on one particular base table as constraints are, so SQL-92 provides the CREATE ASSERTION statement as an alternate method for defining a constraint:


CREATE ASSERTION name CHECK ( condition )


Domain constraints are defined by CREATE DOMAIN or ALTER DOMAIN statements:


Domain constraint:


[ CONSTRAINT name ] CHECK constraint


[ { INITIALLY DEFERRED | INITIALLY IMMEDIATE} ] [ [ NOT ] DEFERRABLE ]


Table constraint definition:


[ CONSTRAINT name ] { PRIMARY KEY ( column , … ) | FOREIGN KEY constraint | UNIQUE constraint | CHECK constraint }    [ { INITIALLY DEFERRED | INI


TIALLY IMMEDIATE} ] [ [ NOT ] DEFERRABLE ]


Column constraint definition:


[ CONSTRAINT name ] { NOT NULL | PRIMARY KEY | FOREIGN KEY constraint | UNIQUE | CHECK constraint }    [ { INITIALLY DEFERRED | INITIALLY IMME

Скачать в pdf «PostgreSQL»