summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2025-05-28 00:43:46 +0000
committerMichael Paquier2025-05-28 00:43:46 +0000
commit52d08620e48c0c24d1d69179c88e49f9223f309d (patch)
tree02c02e03ee01c2059cb1f82ff3ade36bc24fd5e5
parente9e535d611204266a3c2b587afd9ffbe346fc067 (diff)
Adjust regex for test with opening parenthesis in character classes
As written, the test was throwing an error because of an unbalanced parenthesis. The regex used in the test is adjusted to not fail and to test the case of an opening parenthesis in a character class after some nested square brackets. Oversight in d46911e584d4. Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/test/regress/expected/strings.out9
-rw-r--r--src/test/regress/sql/strings.sql2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/test/regress/expected/strings.out b/src/test/regress/expected/strings.out
index ff6b00e5672..cb7aa5a1f2c 100644
--- a/src/test/regress/expected/strings.out
+++ b/src/test/regress/expected/strings.out
@@ -631,8 +631,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '$[$[:alnum:]$]$'
(2 rows)
-- Opening parenthesis "("
-EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '([([:alnum:](](';
-ERROR: invalid regular expression: parentheses () not balanced
+EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '()[([:alnum:](]()';
+ QUERY PLAN
+------------------------------------------------------
+ Seq Scan on text_tbl
+ Filter: (f1 ~ '^(?:(?:)[([:alnum:](](?:))$'::text)
+(2 rows)
+
-- Caret "^"
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '^[^[:alnum:]^[^^][[^^]][\^][[\^]]\^]^';
QUERY PLAN
diff --git a/src/test/regress/sql/strings.sql b/src/test/regress/sql/strings.sql
index e1c520580fb..1f01919496a 100644
--- a/src/test/regress/sql/strings.sql
+++ b/src/test/regress/sql/strings.sql
@@ -204,7 +204,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '.[.[:alnum:].].'
-- Dollar "$"
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '$[$[:alnum:]$]$';
-- Opening parenthesis "("
-EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '([([:alnum:](](';
+EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '()[([:alnum:](]()';
-- Caret "^"
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '^[^[:alnum:]^[^^][[^^]][\^][[\^]]\^]^';
-- Closing square bracket "]" at the beginning of character class