Skip to content

MySQL: [[NOT] ENFORCED] in CHECK constraint#1870

Merged
iffyio merged 3 commits intoapache:mainfrom
MohamedAbdeen21:mysql-enforced-constraint
Jun 7, 2025
Merged

MySQL: [[NOT] ENFORCED] in CHECK constraint#1870
iffyio merged 3 commits intoapache:mainfrom
MohamedAbdeen21:mysql-enforced-constraint

Conversation

@MohamedAbdeen21
Copy link
Copy Markdown
Contributor

Add support for MySQL's [[NOT] ENFORCED] option for CHECK constraints.

docs: https://dev.mysql.com/doc/refman/8.4/en/create-table.html

Comment thread src/parser/mod.rs Outdated
self.expect_token(&Token::RParen)?;
Ok(Some(TableConstraint::Check { name, expr }))

let enforced = match dialect_of!(self is GenericDialect | MySqlDialect) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can have the parser always accept the NOT ENFORCED keywords if they show up in the statement? Otherwise we'd want to turn this into a dialect method instead of using the dialect_of macro but that feels like it might not be worth it in this case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated and rebased on main

@MohamedAbdeen21 MohamedAbdeen21 force-pushed the mysql-enforced-constraint branch from 927aefc to 20646fc Compare June 7, 2025 00:52
Copy link
Copy Markdown
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @MohamedAbdeen21!
cc @alamb

@iffyio iffyio merged commit 84c3a1b into apache:main Jun 7, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants