You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#23456 incorrectly changed the
invokation of the like function to use the unescaped pattern for a call
that expects the pattern to still contain the escape characters. As a
result, any escaped characters were treated as though they were not
escaped. This affects certain queries when all arguments to the like
predicate are constants.
assertQuerySucceeds("SELECT IF('_T' LIKE '#_T' ESCAPE '#', c0, c1) FROM (values (true, false)) t(c0, c1)");
39
-
assertQuerySucceeds("SELECT IF(c2 LIKE 'T' ESCAPE '#', c0, c1) FROM (values (true, false, 'T')) t(c0, c1, c2)");
39
+
assertQuery("SELECT IF('xT' LIKE '#_T' ESCAPE '#', c0, c1) FROM (values (true, false)) t(c0, c1)", "SELECT false");
40
+
assertQuery("SELECT IF(c2 LIKE 'T' ESCAPE '#', c0, c1) FROM (values (true, false, 'T')) t(c0, c1, c2)", "SELECT true");
41
+
}
42
+
43
+
@Test
44
+
publicvoidtestLikeQueriesWithInvalidEscape()
45
+
{
40
46
assertQueryFails("SELECT IF('T' LIKE '###T' ESCAPE '##', c0, c1) FROM (values (true, false)) t(c0, c1)", ".*Escape string must be a single character$");
41
47
assertQueryFails("SELECT IF(c2 LIKE '' ESCAPE '', c0, c1) FROM (values (true, false, 'T')) t(c0, c1, c2)", ".*Escape string must be a single character$");
0 commit comments