Skip to content

Commit 31ee5ec

Browse files
committed
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 d46911e. Discussion: https://postgr.es/m/16ab039d1af455652bdf4173402ddda145f2c73b.camel@cybertec.at
1 parent 9481d16 commit 31ee5ec

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/test/regress/expected/strings.out

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,8 +592,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '$[$[:alnum:]$]$'
592592
(2 rows)
593593

594594
-- Opening parenthesis "("
595-
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '([([:alnum:](](';
596-
ERROR: invalid regular expression: parentheses () not balanced
595+
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '()[([:alnum:](]()';
596+
QUERY PLAN
597+
------------------------------------------------------
598+
Seq Scan on text_tbl
599+
Filter: (f1 ~ '^(?:(?:)[([:alnum:](](?:))$'::text)
600+
(2 rows)
601+
597602
-- Caret "^"
598603
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '^[^[:alnum:]^[^^][[^^]][\^][[\^]]\^]^';
599604
QUERY PLAN

src/test/regress/sql/strings.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '.[.[:alnum:].].'
194194
-- Dollar "$"
195195
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '$[$[:alnum:]$]$';
196196
-- Opening parenthesis "("
197-
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '([([:alnum:](](';
197+
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '()[([:alnum:](]()';
198198
-- Caret "^"
199199
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '^[^[:alnum:]^[^^][[^^]][\^][[\^]]\^]^';
200200
-- Closing square bracket "]" at the beginning of character class

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy