Skip to content

Commit bd3ce05

Browse files
authored
fix: restore GENERATED ALWAYS AS IDENTITY parsing (#2397)
1 parent 1ee3682 commit bd3ce05

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jjt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9790,7 +9790,7 @@ List<String> CreateParameter():
97909790
| tk=<K_TYPE> | tk=<K_COMMENT> | tk=<K_USING> | tk=<K_COLLATE> | tk=<K_ASC>
97919791
| tk=<K_DESC> | tk=<K_TRUE> | tk=<K_FALSE> | tk=<K_PARALLEL> | tk=<K_BINARY> | tk=<K_START> | tk=<K_ORDER>
97929792
| tk=<K_TIME_KEY_EXPR> | tk=<K_RAW> | tk=<K_HASH> | tk=<K_FIRST> | tk=<K_LAST> | tk = <K_SIGNED> | tk = <K_UNSIGNED>
9793-
| tk=<K_ENGINE> | tk=<K_IDENTITY> | tk=<K_MATERIALIZED> | tk=<K_SAMPLE>
9793+
| tk=<K_ENGINE> | tk=<K_IDENTITY> | tk=<K_MATERIALIZED> | tk=<K_SAMPLE> | tk=<K_ALWAYS>
97949794
| tk="="
97959795
)
97969796
{ param.add(tk.image); }

src/test/java/net/sf/jsqlparser/statement/create/CreateTableTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,18 @@ public void testCreateTableIssue1230() throws JSQLParserException {
926926
"CREATE TABLE TABLE_HISTORY (ID bigint generated by default as identity, CREATED_AT timestamp not null, TEXT varchar (255), primary key (ID))");
927927
}
928928

929+
@Test
930+
public void testCreateTableGeneratedAlwaysAsIdentityRegression() throws JSQLParserException {
931+
assertSqlCanBeParsedAndDeparsed(
932+
"create table if not exists book_type ( id bigint not null generated always as identity )");
933+
}
934+
935+
@Test
936+
public void testCreateTableGeneratedByDefaultAsIdentityRegression() throws JSQLParserException {
937+
assertSqlCanBeParsedAndDeparsed(
938+
"create table if not exists book_type ( id bigint not null generated by default as identity )");
939+
}
940+
929941
@Test
930942
public void testCreateUnionIssue1309() throws JSQLParserException {
931943
assertSqlCanBeParsedAndDeparsed(

0 commit comments

Comments
 (0)