ALTER DOMAIN

Synopsis

Use the ALTER DOMAIN statement to change the definition of an existing domain.

Syntax

  1. alter_domain_default ::= ALTER DOMAIN name
  2. { SET DEFAULT expression | DROP DEFAULT }
  3. alter_domain_rename ::= ALTER DOMAIN name RENAME TO name

alter_domain_default

ALTER DOMAIN - 图1

alter_domain_rename

ALTER DOMAIN - 图2

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

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

See also