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
29 changes: 14 additions & 15 deletions src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -3593,7 +3593,7 @@ AlterExpression AlterExpression():
List<String> columnNames = null;
List<ConstraintState> constraints = null;
ForeignKeyIndex fkIndex = null;
NamedConstraint index = null;
Index index = null;
Table fkTable = null;
AlterExpression.ColumnDataType alterExpressionColumnDataType = null;
}
Expand All @@ -3604,20 +3604,19 @@ AlterExpression AlterExpression():
(
LOOKAHEAD(2) ( <K_PRIMARY> <K_KEY> columnNames=ColumnsNamesList() { alterExp.setPkColumns(columnNames); } ) constraints=AlterExpressionConstraintState() { alterExp.setConstraints(constraints); }
|
LOOKAHEAD(2) (
tk=<K_INDEX>
sk3=ColumnsNamesListItem()
{
columnNames = new ArrayList();
columnNames.add(sk3);

index = new NamedConstraint();
index.setType(tk.image);
index.setColumnsNames(columnNames);
alterExp.setIndex(index);
}
constraints=AlterExpressionConstraintState() { alterExp.setConstraints(constraints); }
)
LOOKAHEAD(2) (
tk = < K_INDEX >
sk3 = RelObjectName()
columnNames = ColumnsNamesList()
{
index = new Index();
index.setType(tk.image);
index.setName(sk3);
index.setColumnsNames(columnNames);
alterExp.setIndex(index);
}
constraints=AlterExpressionConstraintState() { alterExp.setConstraints(constraints); }
)
|
( (LOOKAHEAD(2) <K_COLUMN>)?
alterExpressionColumnDataType = AlterExpressionColumnDataType() { alterExp.addColDataType(alterExpressionColumnDataType); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Ignore;
import org.junit.Test;

public class AlterTest {
Expand Down Expand Up @@ -313,8 +312,7 @@ public void testIssue633() throws JSQLParserException {
}

@Test
@Ignore
public void testIssue679() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("ALTER TABLE tb_session_status ADD INDEX idx_user_id(user_id)");
assertSqlCanBeParsedAndDeparsed("ALTER TABLE tb_session_status ADD INDEX idx_user_id_name (user_id, user_name(10)), ADD INDEX idx_user_name (user_name)");
}
}