Skip to content

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

@nicktobey

Description

@nicktobey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions