ClickHouse/docs/en/sql-reference/statements/alter/constraint.md
Alexey Milovidov 1062e6316f Fix cast
2024-11-18 01:35:03 +01:00

796 B

slug sidebar_position sidebar_label
/en/sql-reference/statements/alter/constraint 43 CONSTRAINT

Manipulating Constraints

Constraints could be added or deleted using following syntax:

ALTER TABLE [db].name [ON CLUSTER cluster] ADD CONSTRAINT [IF NOT EXISTS] constraint_name CHECK expression;
ALTER TABLE [db].name [ON CLUSTER cluster] DROP CONSTRAINT [IF EXISTS] constraint_name;

See more on constraints.

Queries will add or remove metadata about constraints from table, so they are processed immediately.

:::tip Constraint check will not be executed on existing data if it was added. :::

All changes on replicated tables are broadcast to ZooKeeper and will be applied on other replicas as well.