JSQLParser / JSqlParser

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern

Home Page:https://github.com/JSQLParser/JSqlParser/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] JSQLParser 4.8 : Clickhouse : Optional specifier not visualizing

danielpetrov01 opened this issue · comments

Failing SQL Feature:

When creating a new AlterExpression and setting an optionalSpecifier, it isnt added to the AlterExpression.
This is needed for ClickHouse due to the fact that for example in MySql CHANGE [COLUMN] col1 col2 has an optional specifier COLUMN. In Clickhouse this change statement, when col1 <> col2, is equivalent to RENAME COLUMN col1 TO col2 and then MODIFY COLUMN col2.

Java Example:

AlterExpression renameExpression = new AlterExpression();
renameExpression.setOperation(AlterOperation.RENAME);
renameExpression.setOptionalSpecifier("COLUMN");
renameExpression.setColumnOldName("col1");
renameExpression.setColumnName("col2");
Screenshot 2024-01-26 at 10 44 10

Software Information:

  • JSqlParser version 4.8
  • Database Clickhouse