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

Add IDENTIFIED in mysql keywords #692

Merged
merged 2 commits into from
Dec 9, 2023
Merged

Conversation

eeeXun
Copy link
Contributor

@eeeXun eeeXun commented Dec 9, 2023

Fix #691

Copy link

codesandbox-ci bot commented Dec 9, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@eeeXun
Copy link
Contributor Author

eeeXun commented Dec 9, 2023

I see IDENTIFIED is in mysql keywords page. But not in mariadb keywords page.
Should I remove the change for mariadb? Although I think these two DBs are the same.

@nene
Copy link
Collaborator

nene commented Dec 9, 2023

MySQL docs list all keywords, but MariaDB docs only the reserved ones (marked by "(R)" in MySQL docs).

@nene
Copy link
Collaborator

nene commented Dec 9, 2023

As IDENTIFIED is not a reserved word, it can be freely used as an identifier. Simply adding it to the keywords array will result in a query like SELECT identified FROM foo to be formatted as SELECT IDENTIFIED FROM foo.

A better approach would be to add "IDENTIFIED BY" to the reservedPhrases array in *.formatter.ts files.

This also applies to SingleStoreDB dialect (which is also a close relative of MySQL).

@nene nene merged commit 5a34e6a into sql-formatter-org:master Dec 9, 2023
2 checks passed
@nene
Copy link
Collaborator

nene commented Dec 9, 2023

Thanks. Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FORMATTING] IDENTIFIED recognized as identifier
2 participants