Skip to content
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

Error parsing CREATE TABLE with both CHECK and NOT NULL #7195

Closed
nicktobey opened this issue Dec 19, 2023 · 0 comments · Fixed by dolthub/vitess#295
Closed

Error parsing CREATE TABLE with both CHECK and NOT NULL #7195

nicktobey opened this issue Dec 19, 2023 · 0 comments · Fixed by dolthub/vitess#295

Comments

@nicktobey
Copy link
Contributor

Example SQL:

create table t123 (c1 varchar(5) check (c1 in ('v1', 'v2')) NOT NULL);

This works in MySQL but fails to parse in Dolt with the error "syntax error at position 69 near 'NULL'"

This is most likely happening because the grammar for CHECK expressions is [CONSTRAINT [symbol]] CHECK (expr) [[NOT] ENFORCED]

Dolt uses an LL1 parser that is likely assuming that the NOT is part of the check expression and is expecting it to be followed by ENFORCED.

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 a pull request may close this issue.

1 participant