]> granicus.if.org Git - postgresql/commitdiff
Make regular-expression error messages a tad less obscure,
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 19 Mar 2001 22:27:46 +0000 (22:27 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 19 Mar 2001 22:27:46 +0000 (22:27 +0000)
per gripe from Josh Berkus.

src/backend/regex/regerror.c
src/backend/regex/regex.3
src/backend/utils/adt/regexp.c

index b9b7ada2508332aeee2a112571fb2944f693fc89..5ed1f9f97523ca89445a9d28c4914a9c4a76165f 100644 (file)
@@ -59,10 +59,11 @@ static struct rerr
 
 {
        {
-               REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"
+               /* NOMATCH is not really an error condition, it just says no match */
+               REG_NOMATCH, "REG_NOMATCH", "no pattern match found"
        },
        {
-               REG_BADPAT, "REG_BADPAT", "invalid regular expression"
+               REG_BADPAT, "REG_BADPAT", "invalid regex struct"
        },
        {
                REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"
@@ -77,28 +78,28 @@ static struct rerr
                REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"
        },
        {
-               REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"
+               REG_EBRACK, "REG_EBRACK", "brackets [ ] not balanced"
        },
        {
-               REG_EPAREN, "REG_EPAREN", "parentheses not balanced"
+               REG_EPAREN, "REG_EPAREN", "parentheses ( ) not balanced"
        },
        {
-               REG_EBRACE, "REG_EBRACE", "braces not balanced"
+               REG_EBRACE, "REG_EBRACE", "braces { } not balanced"
        },
        {
-               REG_BADBR, "REG_BADBR", "invalid repetition count(s)"
+               REG_BADBR, "REG_BADBR", "invalid repetition count(s) in { }"
        },
        {
-               REG_ERANGE, "REG_ERANGE", "invalid character range"
+               REG_ERANGE, "REG_ERANGE", "invalid character range in [ ]"
        },
        {
-               REG_ESPACE, "REG_ESPACE", "out of memory"
+               REG_ESPACE, "REG_ESPACE", "ran out of memory"
        },
        {
-               REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"
+               REG_BADRPT, "REG_BADRPT", "?, *, or + operand invalid"
        },
        {
-               REG_EMPTY, "REG_EMPTY", "empty (sub)expression"
+               REG_EMPTY, "REG_EMPTY", "empty expression or subexpression"
        },
        {
                REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"
index 66a7285d86d20e25eda7172504836b03d5a91ac6..01a6109278a8a640013c54fd60b6806b25ed50ac 100644 (file)
@@ -464,11 +464,11 @@ include the following:
 .PP
 .nf
 .ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH    regexec() failed to match
-REG_BADPAT     invalid regular expression
+REG_NOMATCH    no pattern match found
+REG_BADPAT     invalid regex struct
 REG_ECOLLATE   invalid collating element
 REG_ECTYPE     invalid character class
-REG_EESCAPE    \e applied to unescapable character
+REG_EESCAPE    trailing backslash (\e)
 REG_ESUBREG    invalid backreference number
 REG_EBRACK     brackets [ ] not balanced
 REG_EPAREN     parentheses ( ) not balanced
@@ -477,7 +477,7 @@ REG_BADBR   invalid repetition count(s) in { }
 REG_ERANGE     invalid character range in [ ]
 REG_ESPACE     ran out of memory
 REG_BADRPT     ?, *, or + operand invalid
-REG_EMPTY      empty (sub)expression
+REG_EMPTY      empty expression or subexpression
 REG_ASSERT     ``can't happen''\(emyou found a bug
 REG_INVARG     invalid argument, e.g. negative-length string
 .fi
index 09e1e358dec8640e534abfbe8aef7fd9255be4fd..b55cb3b42e75516488ec014e8517e58b1882ab5b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.34 2001/01/24 19:43:14 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.35 2001/03/19 22:27:46 tgl Exp $
  *
  *             Alistair Crooks added the code for the regex caching
  *             agc - cached the regular expressions used - there's a good chance
@@ -140,7 +140,7 @@ RE_compile_and_execute(text *text_re, char *text, int cflags)
                /* re didn't compile */
                pg95_regerror(regcomp_result, &rev[oldest].cre_re, errMsg,
                                          sizeof(errMsg));
-               elog(ERROR, "regcomp failed with error %s", errMsg);
+               elog(ERROR, "Invalid regular expression: %s", errMsg);
        }
 
        /* not reached */