taozhi8833998 / node-sql-parser

Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList and convert it back to SQL
https://taozhi8833998.github.io/node-sql-parser/
Apache License 2.0
780 stars 174 forks source link

Throws syntax error when trying to `astify` composite check constraints #1879

Closed 1ilit closed 4 months ago

1ilit commented 4 months ago

Describe the bug Throws syntax error when trying to astify composite check constraints

Database Engine MySQL

To Reproduce -the SQL that be parsed

CREATE TABLE `Pattern` (
  `IsInterpolated` INT NOT NULL,
  `Value` DOUBLE,
  CONSTRAINT `CHK_Value_IsInterpolated` CHECK ((`Value` IS NOT NULL) OR (`IsInterpolated` = 0))
);

-the node-sql-parser version v5.0.0 -the node version v18.18.0

Expected behavior Produce the ast for the constraint

Additional context Minimal reproducible example: https://stackblitz.com/edit/stackblitz-starters-9dpxty?file=index.js