ClickHouse/docs/en/sql-reference/statements/alter/constraint.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
796 B
Markdown
Raw Normal View History

---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/statements/alter/constraint
sidebar_position: 43
sidebar_label: CONSTRAINT
---
2022-06-02 10:55:18 +00:00
# Manipulating Constraints
Constraints could be added or deleted using following syntax:
``` sql
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](../../../sql-reference/statements/create/table.md#constraints).
Queries will add or remove metadata about constraints from table, so they are processed immediately.
2023-03-27 18:54:05 +00:00
:::tip
Constraint check **will not be executed** on existing data if it was added.
:::
2024-11-18 00:35:03 +00:00
All changes on replicated tables are broadcast to ZooKeeper and will be applied on other replicas as well.