GeezerVison is showing github.com — [BUG] JSQLParser 5.3 : PostgreSQL : Cannot parse DROP COLUMN command where data is the column name · Issue #2339 · JSQLParser/JSqlParser
[BUG] JSQLParser 5.3 : PostgreSQL : Cannot parse DROP COLUMN command where data is the column name #2339
Description
Failing SQL Feature:
- Cannot parse DROP COLUMN command where
data is the column name
ALTER TABLE example DROP COLUMN data; can't be parsed
SQL Example:
-
ALTER TABLE example DROP COLUMN data;
Software Information:
- JSQLParser 5.3
- PostgreSQL
Tips:
Appears that adding a column with name data works ok
Activity
willneedham93 commented on Nov 12, 2025
ContributorAuthor
More actions
Can confirm adding tk=<K_DATA> as a case in the drop table identifier fixes this
manticore-projects commented on Nov 13, 2025
Reacted by William Needham
willneedham93 commented on Nov 13, 2025
ContributorAuthor
More actions
Thanks for your time!
I can see we recently introduced KeywordOrIdentifier() as part of #2203, which appears to be used in other branches of alterexpression.
Would it be suitable to use that in the DROP branch for consistency and extend to additionally handle the K_DATA token? I have this working with a test case locally and am happy to raise a PR.
Although I am aware that continually appending tokens to that may not be ideal and refactoring to use RelObjectName may be preferred
manticore-projects commented on Nov 13, 2025
KeywordOrIdentifier() is not sufficient.
You need RelObjectName instead.
Metadata
Metadata
Development
No branches or pull requestsIssue actions