Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ public static ParsedSql parseSqlStatement(final String sql) {
}
}
if (c == '?') {
int j = i + 1;
if (j < statement.length && statement[j] == '?') {
// Postgres-style "??" ?-operator - to be skipped.
i = i + 2;
continue;
}
unnamedParameterCount++;
totalParameterCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ public void parseSqlStatementWithPostgresCasting() throws Exception {
assertEquals(expectedSql, NamedParameterUtils.substituteNamedParameters(parsedSql, null));
}

/*
* SPR-13582
*/
@Test
public void parseSqlStatementWithPostgresContainedOperator() throws Exception {
String expectedSql = "select 'first name' from artists where info->'stat'->'albums' = ?? ? and '[\"1\",\"2\",\"3\"]'::jsonb ?? '4'";
String sql = "select 'first name' from artists where info->'stat'->'albums' = ?? :album and '[\"1\",\"2\",\"3\"]'::jsonb ?? '4'";
ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql);
assertEquals(1, parsedSql.getTotalParameterCount());
assertEquals(expectedSql, NamedParameterUtils.substituteNamedParameters(parsedSql, null));
}

/*
* SPR-7476
*/
Expand Down