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

Fix parsing ALTER TABLE ... ADD COLUMNS (...) #2087

Merged

Conversation

njaremko
Copy link
Contributor

@njaremko njaremko commented Oct 15, 2024

The current behaviour fails when it encounters ADD COLUMNS and merges everything in the () into one string with no whitespace.

So ALTER TABLE catalog.table.name ADD COLUMNS (apples int) becomes ALTER TABLE catalog.table.name ADD COLUMNS (applesint).

This commit adds an understanding of ALTER TABLE ... ADD COLUMNS to the grammar.

(
<K_COLUMN> { alterExp.hasColumn(true); }
|
<K_COLUMNS> { alterExp.hasColumns(true); }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems I auto-formatted this file. This is the only change, but I can remove the formatting bit if that matters.

@njaremko njaremko force-pushed the nathan/fix-alter-columns-parse branch from 84ed566 to 9672d76 Compare October 15, 2024 20:07
@manticore-projects
Copy link
Contributor

Thank you for your contribution, please fix formatting exception by running './gradlew :spotlessApply' to fix these violations.

The current behaviour fails when it encounters `ADD COLUMNS` and merges
everything in the `()` into one string with no whitespace.

So `ALTER TABLE catalog.table.name ADD COLUMNS (apples int)` becomes
`ALTER TABLE catalog.table.name ADD COLUMNS (applesint)`.

This commit adds an understanding of how `ADD COLUMNS` to the grammar.
@njaremko njaremko force-pushed the nathan/fix-alter-columns-parse branch from 9672d76 to bcdadc8 Compare October 23, 2024 17:45
@njaremko
Copy link
Contributor Author

Done

@manticore-projects manticore-projects merged commit 229099c into JSQLParser:master Oct 24, 2024
3 checks passed
@manticore-projects
Copy link
Contributor

Thank you for your contribution!

@njaremko njaremko deleted the nathan/fix-alter-columns-parse branch October 24, 2024 21:45
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.

2 participants