Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -8731,11 +8731,13 @@ String AList():
String ColumnsNamesListItem():
{
Token tk = null;
Token sortDirection = null;
String item = null;
}
{
( item = RelObjectName() )
[ LOOKAHEAD(2) "(" tk = <S_LONG> ")" { item = item + "(" + tk.image + ")"; } ]
[ (sortDirection = <K_ASC> | sortDirection = <K_DESC>) { item = item + " " + sortDirection.image; } ]
{
return item;
}
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/net/sf/jsqlparser/statement/alter/AlterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,17 @@ public void testAlterTableIndex586() throws Exception {
+ "USING BTREE, ALGORITHM = INPLACE", result.toString());
}

@Test
public void testAlterTableDropAndAddUniqueIndexWithAscendingColumns() throws Exception {
Statement result =
CCJSqlParserUtil.parse("ALTER TABLE `wxp_dm`.`xqgl_req_report` "
+ "DROP INDEX `index_name`, "
+ "ADD UNIQUE INDEX `index_name`(`report_name` ASC) USING BTREE");
assertEquals("ALTER TABLE `wxp_dm`.`xqgl_req_report` DROP INDEX `index_name`, "
+ "ADD UNIQUE INDEX `index_name` (`report_name` ASC) USING BTREE",
result.toString());
}

@Test
public void testIssue259() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed(
Expand Down