Bug #69556 Check constraints not supported
Submitted: 24 Jun 2013 3:39 Modified: 25 Jun 2013 0:31
Reporter: Gareth Humphries Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: check, check constraint, constraint

[24 Jun 2013 3:39] Gareth Humphries
Description:
I was surprised to find that this isn't the system already.

MySQL doesn't support check constraints.  As noted in the documentation, the syntax is parsed but ignored.  It would be useful if check constraints were enforced.

This would help give me faith in my data integrity, and would provide some valuable information to the query optimiser to help performance.

How to repeat:
create table repro (a integer unsigned not null check (a > 100)); insert into repro (1);

Suggested fix:
Enforce check constraints.
[24 Jun 2013 4:56] MySQL Verification Team
for the general complaint about ignoring things silently:
http://bugs.mysql.com/bug.php?id=47771
[24 Jun 2013 11:15] MySQL Verification Team
See Bug #3464
[25 Jun 2013 0:31] Gareth Humphries
This is not so much a bug report about the parser ignoring statements as it is a feature request for check constraints to be implemented.

The behaviour of the parser is well known, documented, and tracked - however best I can tell there exists no ticket tracking the missing check constraints - that is the point of this feature request.
[25 Jun 2013 5:21] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=3464 is the feature request to implement check contraints.