-
Notifications
You must be signed in to change notification settings - Fork 442
Add PostgreSQL COMMENT keyword #924
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
Conversation
|
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. |
|
Thanks for the pull request. Please describe what sort of issue you are trying to solve with this change. FYI, this list of keywords that you edited is supposed to only include reserved keywords, and |
|
I have sql-formatter configured for PostgreSQL and to capitalize keywords,
but it's not capitalising COMMENT.
…On Tue, 9 Dec 2025, 7:36 pm Rene Saarsoo, ***@***.***> wrote:
*nene* left a comment (sql-formatter-org/sql-formatter#924)
<#924 (comment)>
Thanks for the pull request.
Please describe what sort of issue you are trying to solve with this
change.
FYI, this list of keywords that you edited is supposed to only include
reserved keywords, and COMMENT is not a reserved keyword in PostgreSQL.
—
Reply to this email directly, view it on GitHub
<#924 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABOUMJDJFOY3NKZNBHN5OCT4A4QEJAVCNFSM6AAAAACORBFUT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMZTHE2TGMZXHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
I think a better fix for this is to add Though in general I should point out that SQL Formatter is fundamentally limited when it comes to distinguishing keywords from non-keywords, because it depends on the context whether something is a keyword or not. Like you could use |
|
Ok, would you like me to make that change or just close this PR as not
supported?
…On Tue, 9 Dec 2025, 9:19 pm Rene Saarsoo, ***@***.***> wrote:
*nene* left a comment (sql-formatter-org/sql-formatter#924)
<#924 (comment)>
I think a better fix for this is to add COMMENT ON to the
tabularOnelineClauses section in postgresql.formatter.ts
Though in general I should point out that SQL Formatter is fundamentally
limited when it comes to distinguishing keywords from non-keywords, because
it depends on the context whether something is a keyword or not. Like you
could use comment as the name of a column or table, and then you would
not want it to be capitalized. But because SQL Formatter doesn't fully
parse the SQL, it can't tell the difference. And so there are many-many
more keywords in PostgreSQL that this formatter isn't able to correctly
identify as keywords.
—
Reply to this email directly, view it on GitHub
<#924 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABOUMJGDIX2NQRDTXPJZAAD4A44HTAVCNFSM6AAAAACORBFUT6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMZUGMZDINZWGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
I'd be happy to accept a PR with that change. For today I'm going to sleep :) FYI, if you're looking for a formatter that doesn't have this sort of limitation, I suggest you check out prettier-plugin-sql-cst |
|
Fixed it myself. Closing this. |
|
Thank you! |
https://www.postgresql.org/docs/14/sql-comment.html