Skip to content

Commit

Permalink
allow 'key' as object name
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Oct 30, 2014
1 parent d9951d7 commit 32b0a67
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/javacc/net/sf/jsqlparser/parser/JSqlParserCC.jj
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ String RelObjectName():
| tk=<K_CAST> | tk=<K_DO> | tk=<K_EXTRACT> | tk=<K_FIRST> | tk=<K_FOLLOWING>
| tk=<K_LAST> | tk=<K_MATERIALIZED> | tk=<K_NULLS> | tk=<K_PARTITION> | tk=<K_RANGE>
| tk=<K_ROW> | tk=<K_ROWS> | tk=<K_SIBLINGS> | tk=<K_VALUE> | tk=<K_XML>
| tk=<K_COLUMN> | tk=<K_REPLACE> | tk=<K_TRUNCATE> )
| tk=<K_COLUMN> | tk=<K_REPLACE> | tk=<K_TRUNCATE> | tk=<K_KEY> )

{ return tk.image; }
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/java/net/sf/jsqlparser/test/insert/InsertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,10 @@ public void testInsertWithSelect() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("INSERT INTO mytable (mycolumn) WITH a AS (SELECT mycolumn FROM mytable) SELECT mycolumn FROM a");
assertSqlCanBeParsedAndDeparsed("INSERT INTO mytable (mycolumn) (WITH a AS (SELECT mycolumn FROM mytable) SELECT mycolumn FROM a)");
}

@Test
public void testInsertWithKeywords() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("INSERT INTO kvPair (value, key) VALUES (?, ?)");
}

}

0 comments on commit 32b0a67

Please sign in to comment.