DROP DOMAIN
Synopsis
Use the DROP DOMAIN
statement to remove a domain from the database.
Syntax
drop_domain ::= DROP DOMAIN [ IF EXISTS ] name [ , ... ]
[ CASCADE | RESTRICT ]
drop_domain
Semantics
drop_domain
name
Specify the name of the existing domain. An error is raised if the specified domain does not exist (unless IF EXISTS
is set). An error is raised if any objects depend on this domain (unless CASCADE
is set).
IF EXISTS
Do not throw an error if the domain does not exist.
CASCADE
Automatically drop objects that depend on the domain such as table columns using the domain data type and, in turn, all other objects that depend on those objects.
RESTRICT
Refuse to drop the domain if objects depend on it (default).
Examples
Example 1
yugabyte=# CREATE DOMAIN idx DEFAULT 5 CHECK (VALUE > 0);
yugabyte=# DROP DOMAIN idx;
Example 2
yugabyte=# CREATE DOMAIN idx DEFAULT 5 CHECK (VALUE > 0);
yugabyte=# CREATE TABLE t (k idx primary key);
yugabyte=# DROP DOMAIN idx CASCADE;
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .