matrixorigin / matrixorigin/matrixone
[Bug]: CHECK constraints are parsed but not enforced
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
### Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
### Branch Name
v4.0.0-rc3
### Commit ID
8.0.30-MatrixOne-v4.0.0-rc3
### Other Environment Information
- Hardware parameters: N/A
- OS type: N/A
- Others: Reproduced via cross-language ORM compatibility testing (PHP / Python / Java / Node.js) over the MySQL 8.0.30 wire protocol. The minimal repro below uses raw SQL so it is driver-independent.
### Actual Behavior
`CHECK` is accepted at DDL time but never enforced on writes, so a row that violates it is accepted.
```sql
INSERT INTO t VALUES (-5); -- MatrixOne: accepted
```
### Expected Behavior
The violating row is rejected:
```sql
INSERT INTO t VALUES (-5); -- MySQL 8.0.16+: rejected (ERROR 3819 Check constraint violated)
```
### Steps to Reproduce
```sql
CREATE TABLE t (age INT CHECK (age >= 0));
INSERT INTO t VALUES (-5); -- MySQL 8.0.16+: rejected MatrixOne: accepted
SELECT * FROM t; -- MatrixOne: returns the -5 row
```
### Additional information
Application invariants relying on `CHECK` become silent no-ops.
**Background:** dengn/php-tester#1.
Contributor guide
Assessment
This issue has not been assessed yet.