Skip to content
Permalink
Browse files

add test for table name with values in it (#1609)

  • Loading branch information
davecramer committed Nov 15, 2019
1 parent 1e37026 commit 47f756fa926f7c78a7f55f030aadf7be82195e52
Showing with 18 additions and 0 deletions.
  1. +18 −0 pgjdbc/src/test/java/org/postgresql/core/ParserTest.java
@@ -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.
You can’t perform that action at this time.