Content-Length: 295381 | pFad | http://github.com/postgres/postgres/commit/52d08620e48c0c24d1d69179c88e49f9223f309d

BB Adjust regex for test with opening parenthesis in character classes · postgres/postgres@52d0862 · GitHub
Skip to content

Commit 52d0862

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 e9e535d commit 52d0862

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
@@ -631,8 +631,13 @@ EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '$[$[:alnum:]$]$'
631631
(2 rows)
632632

633633
-- Opening parenthesis "("
634-
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '([([:alnum:](](';
635-
ERROR: invalid regular expression: parentheses () not balanced
634+
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '()[([:alnum:](]()';
635+
QUERY PLAN
636+
------------------------------------------------------
637+
Seq Scan on text_tbl
638+
Filter: (f1 ~ '^(?:(?:)[([:alnum:](](?:))$'::text)
639+
(2 rows)
640+
636641
-- Caret "^"
637642
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '^[^[:alnum:]^[^^][[^^]][\^][[\^]]\^]^';
638643
QUERY PLAN

src/test/regress/sql/strings.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '.[.[:alnum:].].'
204204
-- Dollar "$"
205205
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '$[$[:alnum:]$]$';
206206
-- Opening parenthesis "("
207-
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '([([:alnum:](](';
207+
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '()[([:alnum:](]()';
208208
-- Caret "^"
209209
EXPLAIN (COSTS OFF) SELECT * FROM TEXT_TBL WHERE f1 SIMILAR TO '^[^[:alnum:]^[^^][[^^]][\^][[\^]]\^]^';
210210
-- Closing square bracket "]" at the beginning of character class

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgres/postgres/commit/52d08620e48c0c24d1d69179c88e49f9223f309d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy