Skip to content

Commit f8be15e

Browse files
authored
Merge pull request #17514 from def-/pr-platform-check-like-escape
Platform checks: Add ESCAPE to LIKE/ILIKE (part of #17471)
2 parents 8ae468e + 25d331d commit f8be15e

File tree

1 file changed

+12
-12
lines changed
  • misc/python/materialize/checks

1 file changed

+12
-12
lines changed

misc/python/materialize/checks/like.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def initialize(self) -> Testdrive:
2020
return Testdrive(
2121
dedent(
2222
"""
23-
> CREATE TABLE like_regex_table (f1 STRING, f2 STRING);
24-
> INSERT INTO like_regex_table VALUES ('abc', 'abc');
23+
> CREATE TABLE like_regex_table (f1 STRING, f2 STRING, f3 STRING, f4 STRING);
24+
> INSERT INTO like_regex_table VALUES ('abc', 'abc', 'a~%', '~');
2525
"""
2626
)
2727
)
@@ -31,12 +31,12 @@ def manipulate(self) -> List[Testdrive]:
3131
Testdrive(dedent(s))
3232
for s in [
3333
"""
34-
> CREATE MATERIALIZED VIEW like_regex_view1 AS SELECT f1 LIKE f2 AS c1, f1 ILIKE f2 AS c2, f1 LIKE 'x_z' AS c3, f1 ILIKE 'a_c' AS c4 FROM like_regex_table;
35-
> INSERT INTO like_regex_table VALUES ('klm', 'klm');
34+
> CREATE MATERIALIZED VIEW like_regex_view1 AS SELECT f1 LIKE f2 AS c1, f1 ILIKE f2 AS c2, f1 LIKE 'x_z' AS c3, f1 ILIKE 'a_c' AS c4, f1 LIKE 'a~%' ESCAPE '~' AS c5, f1 LIKE f3 ESCAPE '~' AS c6, f1 LIKE f3 ESCAPE f4 AS c7 FROM like_regex_table;
35+
> INSERT INTO like_regex_table VALUES ('klm', 'klm', 'k_m', 'k');
3636
""",
3737
"""
38-
> CREATE MATERIALIZED VIEW like_regex_view2 AS SELECT f1 LIKE f2 AS c1, f1 ILIKE f2 AS c2, f1 LIKE 'x_z' AS c3, f1 ILIKE 'a_c' AS c4 FROM like_regex_table;
39-
> INSERT INTO like_regex_table VALUES ('xyz', 'xyz');
38+
> CREATE MATERIALIZED VIEW like_regex_view2 AS SELECT f1 LIKE f2 AS c1, f1 ILIKE f2 AS c2, f1 LIKE 'x_z' AS c3, f1 ILIKE 'a_c' AS c4, f1 LIKE 'a~%' ESCAPE '~' AS c5, f1 LIKE f3 ESCAPE '~' AS c6, f1 LIKE f3 ESCAPE f4 AS c7 FROM like_regex_table;
39+
> INSERT INTO like_regex_table VALUES ('xyz', 'xyz', 'x_%', '_');
4040
""",
4141
]
4242
]
@@ -46,14 +46,14 @@ def validate(self) -> Testdrive:
4646
dedent(
4747
"""
4848
> SELECT * FROM like_regex_view1;
49-
true true false true
50-
true true false false
51-
true true true false
49+
true true false true false false false
50+
true true false false false true false
51+
true true true false false true false
5252
5353
> SELECT * FROM like_regex_view2;
54-
true true false true
55-
true true false false
56-
true true true false
54+
true true false true false false false
55+
true true false false false true false
56+
true true true false false true false
5757
"""
5858
)
5959
)

0 commit comments

Comments
 (0)