mysql手册中写道:存储引擎会解析check子句,但是会把它忽略掉
The CHECK clause is parsed but ignored by all storage engines.
现在还没找到check约束开启的东西,但找到了解决办法:
mysql> delimiter // mysql> CREATE TRIGGER trig_sd_check BEFORE INSERT ON Customer -> FOR EACH ROW -> BEGIN -> IF NEW.SD<0 THEN -> SET NEW.SD=0; -> END IF; -> END -> // mysql> delimiter ;
http://stackoverflow.com/questions/2115497/check-constraint-in-mysql-is-not-working
时间: 2024-10-20 03:08:01