Re: Improved regular expression error message for backrefs

2021-08-22 Thread Mark Dilger
> On Aug 22, 2021, at 7:47 PM, Tom Lane wrote: > > Yeah: the POSIX standard says what the error codes from regcomp() are. I'm not sure how to interpret them. The language "The implementation may define additional macros or constants using names beginning with REG_" at the bottom of the doc

Re: Improved regular expression error message for backrefs

2021-08-22 Thread Tom Lane
Mark Dilger writes: > The patch defines a new error code REG_ENOBREF in regex/regex.h right next to > REG_ESUBREG from which it is split out, rather than at the end of the list. > Is there a project preference to add it at the end? Certainly, that would > give a shorter git diff. > Are there

Improved regular expression error message for backrefs

2021-08-22 Thread Mark Dilger
Hackers, Please find attached an improvement to the error messages given for invalid backreference usage: select 'xyz' ~ '(.)(.)\3'; ERROR: invalid regular expression: invalid backreference number select 'xyz' ~ '(.)(.)(?=\2)'; -ERROR: invalid regular expression: invalid backreference numbe