Skip to content

Commit

Permalink
add test for table name with values in it (#1609)
Browse files Browse the repository at this point in the history
  • Loading branch information
davecramer committed Nov 15, 2019
1 parent 1e37026 commit 47f756f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pgjdbc/src/test/java/org/postgresql/core/ParserTest.java
Expand Up @@ -216,4 +216,22 @@ public void insertMultiInsert() throws SQLException {
Assert.assertEquals(34, command.getBatchRewriteValuesBraceOpenPosition());
Assert.assertEquals(56, command.getBatchRewriteValuesBraceClosePosition());
}

@Test
public void valuesTableParse() throws SQLException {
String query = "insert into values_table (id, name) values (?,?)";
List<NativeQuery> qry = Parser.parseJdbcSql(query, true, true, true, true);
SqlCommand command = qry.get(0).getCommand();
Assert.assertEquals(43,command.getBatchRewriteValuesBraceOpenPosition());
Assert.assertEquals(49,command.getBatchRewriteValuesBraceClosePosition());

query = "insert into table_values (id, name) values (?,?)";
qry = Parser.parseJdbcSql(query, true, true, true, true);
command = qry.get(0).getCommand();
Assert.assertEquals(43,command.getBatchRewriteValuesBraceOpenPosition());
Assert.assertEquals(49,command.getBatchRewriteValuesBraceClosePosition());



}
}

0 comments on commit 47f756f

Please sign in to comment.