Skip to content

CHECK with IN clause does not parse #121

@tomc-goodrx

Description

@tomc-goodrx

Using the IN keyword in a CHECK causes parsing to fail. For example:

`col_name` varchar(5) CHECK( `col_name` = 'year' OR `col_name` = 'month' ),

Works but with an IN statement doesn't:

`col_name` varchar(5) CHECK( `col_name` IN ('year', 'month') ),

With silent=False we get an error like:

  File ".../lib/python3.9/site-packages/simple_ddl_parser/ddl_parser.py", line 199, in p_error
    raise DDLParserError(f"Unknown statement at {p}")
simple_ddl_parser.ddl_parser.DDLParserError: Unknown statement at LexToken(STRING,"'year'",1,544)

Using OR statements becomes unwieldy when there are more than a handful of options in the enum so it would be nice to support this. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions