Skip to content

Commit 9f59715

Browse files
committed
test: add few more tests to PG parser
1 parent 4af9cbe commit 9f59715

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementParserTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,25 @@ public void testPostgreSQLReturningClause() {
14361436
parser
14371437
.parse(Statement.of("insert into t1 select 1 as/*eomment*/returning returning *"))
14381438
.hasReturningClause());
1439+
assertFalse(
1440+
parser
1441+
.parse(Statement.of("UPDATE x SET y = $$ RETURNING a, b, c$$ WHERE z = 123"))
1442+
.hasReturningClause());
1443+
assertFalse(
1444+
parser
1445+
.parse(
1446+
Statement.of("UPDATE x SET y = $foobar$ RETURNING a, b, c$foobar$ WHERE z = 123"))
1447+
.hasReturningClause());
1448+
assertFalse(
1449+
parser
1450+
.parse(Statement.of("UPDATE x SET y = $returning$ returning $returning$ WHERE z = 123"))
1451+
.hasReturningClause());
1452+
assertTrue(
1453+
parser
1454+
.parse(
1455+
Statement.of(
1456+
"UPDATE x SET y = $returning$returning$returning$ WHERE z = 123 ReTuRnInG *"))
1457+
.hasReturningClause());
14391458
}
14401459

14411460
private void assertUnclosedLiteral(String sql) {

0 commit comments

Comments
 (0)