-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CHECK
constraint
#41711
Labels
Comments
CbcWestwolf
added
the
type/feature-request
Categorizes issue or PR as related to a new feature.
label
Feb 24, 2023
12 tasks
12 tasks
17 tasks
17 tasks
Do we have same behavior as MySQL on check constraint? |
Mostly same, I will supply unsupported behavior in doc later |
12 tasks
12 tasks
This was referenced Jun 27, 2023
This was referenced Jun 28, 2023
Looks like this has been implemented in v7.2. Can we close this issue? mysql> SELECT TIDB_VERSION()\G
*************************** 1. row ***************************
TIDB_VERSION(): Release Version: v7.2.0
Edition: Community
Git Commit Hash: 9fd5f4a8e4f273a60fbe7d3848f85a1be8f0600b
Git Branch: heads/refs/tags/v7.2.0
UTC Build Time: 2023-06-27 15:04:42
GoVersion: go1.20.5
Race Enabled: false
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)
mysql> SET GLOBAL tidb_enable_check_constraint=ON;
Query OK, 0 rows affected (0.04 sec)
mysql> CREATE TABLE t1 (id INT PRIMARY KEY, CHECK (id > 10), CHECK (id < 20));
Query OK, 0 rows affected (0.20 sec)
mysql> INSERT INTO t1 VALUES (1);
ERROR 3819 (HY000): Check constraint 't1_chk_1' is violated.
mysql> INSERT INTO t1 VALUES (15);
Query OK, 1 row affected (0.02 sec)
mysql> INSERT INTO t1 VALUES (25);
ERROR 3819 (HY000): Check constraint 't1_chk_2' is violated. |
@dveeden Sure! |
@CbcWestwolf could you help confirm is that a bug? #47567 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
https://dev.mysql.com/doc/refman/8.0/en/create-table-check-constraints.html
The text was updated successfully, but these errors were encountered: