mvzink opened a new pull request, #2183:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2183

   MySQL allows `CONSTRAINT CHECK (expr)` without a name - the database will 
auto-generate a constraint name. This is a MySQL extension; the SQL standard 
requires a name after the CONSTRAINT keyword. See [docs].
   
   Previously, we required an identifier after CONSTRAINT, causing us to 
interpret CONSTRAINT as a column name in cases like:
   
   ```sql
   CREATE TABLE t (x INT, CONSTRAINT CHECK (x > 1))
   ```
   
   Now we check if the token after CONSTRAINT is a constraint type keyword 
(CHECK, PRIMARY, UNIQUE, FOREIGN) and treat the name as optional for dialects 
that support this. This is just MySQL as far as I know (and Generic), but we 
introduce a new `Dialect` flag even though it's a minor feature. We could 
remove the flag and allow the more permissive optional name syntax across 
dialects if desired.
   
   [docs]: https://dev.mysql.com/doc/refman/8.4/en/create-table.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to