top of page
CerebroSQL

PostgreSQL:  

ALTER DOMAIN

ALTER DOMAIN name
{ SET DEFAULT expression | DROP DEFAULT }
ALTER DOMAIN name
{ SET | DROP } NOT NULL
ALTER DOMAIN name
ADD domain_constraint [ NOT VALID ]
ALTER DOMAIN name
DROP CONSTRAINT [ IF EXISTS ] constraint_name [ RESTRICT | CASCADE ]
ALTER DOMAIN name
RENAME CONSTRAINT constraint_name TO new_constraint_name
ALTER DOMAIN name
VALIDATE CONSTRAINT constraint_name
ALTER DOMAIN name
OWNER TO new_owner
ALTER DOMAIN name
RENAME TO new_name
ALTER DOMAIN name
SET SCHEMA new_schema

Example

ALTER DOMAIN zipcode SET NOT NULL;
ALTER DOMAIN zipcode DROP NOT NULL;
ALTER DOMAIN zipcode ADD CONSTRAINT zipchk CHECK (char_length
(VALUE) = 5);

bottom of page