-
Notifications
You must be signed in to change notification settings - Fork 411
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
[FORMATTING] a few cases of unexpected identifierCase "lower" behavior #809
Comments
Well, there's a reason why the identifierCase option is marked as experimental. Though really, all of the other case options ( PostgreSQL in particular is pretty relaxed with regards to keywords - only a few keywords in PostgreSQL are fully reserved and can never be used as identifiers. (Though there are SQL dialects that are even worse in this regard.) The approach SQL Formatter currently uses is to find some sort of sweetspot between two extremes:
SQL Formatter leans on the latter side, which basically means that using This |
If you're looking for a tool that does better job formatting PostgreSQL, you might want to consider prettier-plugin-sql-cst, which does use a proper parser and is capable to properly distinguish between keywords and identifiers. Though currently it only supports changing the case of keywords and it doesn't have full PostgreSQL support because... well... PostgreSQL is such a huge language. |
I updated the docs to make the flaws of this option more apparent. I'll close this issue as "won't fix", because it sort of works as designed. |
@gajus I opened PR #821 to resolve many of these cases, but one which I could not resolve is But everything else should be good, once #821 is published. |
These are the unexpected diffs from PostgreSQL codebase after using the experiment
{ identifierCase: 'lower' }
:Otherwise, it works great.
Thanks for the awesome lib!
The text was updated successfully, but these errors were encountered: