Re: change regexp_substr first argument make tests more easier to understand. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: change regexp_substr first argument make tests more easier to understand.
Date
Msg-id 2005032.1725558329@sss.pgh.pa.us
Whole thread Raw
In response to Re: change regexp_substr first argument make tests more easier to understand.  (Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>)
List pgsql-hackers
Ilia Evdokimov <ilya.evdokimov@tantorlabs.com> writes:
> Current tests with regexp_instr() and regexp_substr()  with string 
> 'abcabcabc' are really unreadable and you would spend time to understand 
> that happens in these tests and if they are really correct. I'd better 
> change them into "abcdefghi" just like in query

>      SELECT regexp_substr('abcdefghi', 'd.q') IS NULL AS t;

On looking more closely at these test cases, I think the point of them
is exactly to show the behavior of the functions with multiple copies
of the target substring.  Thus, what Jian is proposing breaks the
tests: it's no longer perfectly clear whether the result is because
the function did what we expect, or because the pattern failed to
match anywhere else.  (Sure, "a.c" *should* match "aXc", but if it
didn't, you wouldn't discover that from this test.)  What Ilia
proposes would break them worse.

I think we should just reject this patch, or at least reject the
parts of it that change existing test cases.  I have no opinion
about whether the new test cases add anything useful.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Corey Huinker
Date:
Subject: Re: Statistics Import and Export
Next
From: Pavel Borisov
Date:
Subject: Re: Invalid "trailing junk" error message when non-English letters are used