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

MySQL: reporting PRS error when adding unique constraint to multiple columns #1816

Closed
ngdah opened this issue Nov 3, 2021 · 4 comments · Fixed by #2443
Closed

MySQL: reporting PRS error when adding unique constraint to multiple columns #1816

ngdah opened this issue Nov 3, 2021 · 4 comments · Fixed by #2443
Labels
bug Something isn't working good first issue Good for newcomers mysql

Comments

@ngdah
Copy link

ngdah commented Nov 3, 2021

Expected Behaviour

SQLFluff should pass lint check when adding unique constraint to multiple columns in MySQL.
Reference: https://stackoverflow.com/questions/635937/how-do-i-specify-unique-constraint-for-multiple-columns-in-mysql#answer-635943

Observed Behaviour

SQL reported PRS error Found unparsable section

Steps to Reproduce

Prepare a file add_index.sql:

ALTER TABLE `foo`.`bar` ADD UNIQUE `index_name`(`col_1`, `col_2`, `col_3`);

Run sqlfluff lint --dialect=mysql add_index.sql

Output will be

L:   1 | P:  35 |  PRS | Line 1, Position 35: Found unparsable section: '
                       | `index_name`(`col_1`, `col_2`, `col_3`)...'
All Finished 📜 🎉!

Dialect

mysql

Version

Python 3.9.7
sqlfluff, version 0.7.1

Configuration

default

@ngdah ngdah added the bug Something isn't working label Nov 3, 2021
@tunetheweb tunetheweb added the good first issue Good for newcomers label Nov 4, 2021
@tunetheweb
Copy link
Member

This is a great first issue for anyone looking to start contributing to SQLFluff: https://github.com/sqlfluff/sqlfluff/wiki/Contributing-Dialect-Changes

@kayman-mk
Copy link
Contributor

The same holds true for the create table statement.

@tunetheweb
Copy link
Member

Raised #2443 for this.

@kayman-mk could you raise a separate issue for the create table issue with example SQL?

@kayman-mk
Copy link
Contributor

Done with #2515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers mysql
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants