Synopsis

Use the ALTER DOMAIN statement to change the definition of a domain.

Syntax

alter_domain_default ::= ALTER DOMAIN name 
                         { SET DEFAULT expression | DROP DEFAULT }

alter_domain_rename ::= ALTER DOMAIN name RENAME TO name

alter_domain_default

ALTERDOMAINnameSETDEFAULTexpressionDROPDEFAULT

alter_domain_rename

ALTERDOMAINnameRENAMETOname

Semantics

SET DEFAULT | DROP DEFAULT

Set or remove the default value for a domain.

RENAME

Change the name of the domain.

name

Specify the name of the domain. An error is raised if DOMAIN name does not exist or DOMAIN new_name already exists.

Examples

yugabyte=# CREATE DOMAIN idx DEFAULT 5 CHECK (VALUE > 0);
yugabyte=# ALTER DOMAIN idx DROP DEFAULT;
yugabyte=# ALTER DOMAIN idx RENAME TO idx_new;
yugabyte=# DROP DOMAIN idx_new;

See also