Skip to content

Commit 9999c50

Browse files
committed
fixes #177
1 parent 6ea74fd commit 9999c50

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-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
@@ -546,7 +546,7 @@ String RelObjectName() :
546546
| tk=<K_LAST> | tk=<K_MATERIALIZED> | tk=<K_NULLS> | tk=<K_PARTITION> | tk=<K_RANGE>
547547
| tk=<K_ROW> | tk=<K_ROWS> | tk=<K_SIBLINGS> | tk=<K_VALUE> | tk=<K_XML>
548548
| tk=<K_COLUMN> | tk=<K_REPLACE> | tk=<K_TRUNCATE> | tk=<K_KEY> | tk=<K_ANY>
549-
| tk=<K_OPEN> | tk=<K_OVER> | tk=<K_VALUES> | tk=<K_PERCENT>
549+
| tk=<K_OPEN> | tk=<K_OVER> | tk=<K_VALUES> | tk=<K_PERCENT> | tk=<K_PRIOR>
550550
)
551551

552552
{ return tk.image; }

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ public void testCreateTableColumnValue() throws JSQLParserException {
171171
public void testCreateTableForeignKey5() throws JSQLParserException {
172172
assertSqlCanBeParsedAndDeparsed("CREATE TABLE IF NOT EXISTS table1 (id INTEGER PRIMARY KEY AUTO_INCREMENT, aid INTEGER REFERENCES accounts ON aid ON DELETE CASCADE, name STRING, lastname STRING)");
173173
}
174+
175+
public void testCreateTableForeignKey6() throws JSQLParserException {
176+
assertSqlCanBeParsedAndDeparsed("CREATE TABLE test (id long, fkey long references another_table (id))");
177+
}
174178

175179
public void testRUBiSCreateList() throws Exception {
176180
BufferedReader in = new BufferedReader(new InputStreamReader(CreateTableTest.class.getResourceAsStream("/RUBiS-create-requests.txt")));

src/test/java/net/sf/jsqlparser/test/select/SelectTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,10 @@ public void testReservedKeyword2() throws JSQLParserException {
17881788
final String stmt = "SELECT open FROM tableName";
17891789
assertSqlCanBeParsedAndDeparsed(stmt);
17901790
}
1791+
1792+
public void testReservedKeyword3() throws JSQLParserException {
1793+
assertSqlCanBeParsedAndDeparsed("SELECT * FROM mytable1 t JOIN mytable2 AS prior ON t.id = prior.id");
1794+
}
17911795

17921796
public void testCharacterSetClause() throws JSQLParserException {
17931797
String stmt = "SELECT DISTINCT CAST(`view0`.`nick2` AS CHAR (8000) CHARACTER SET utf8) AS `v0` FROM people `view0` WHERE `view0`.`nick2` IS NOT NULL";

0 commit comments

Comments
 (0)