diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c index 826203e35d2..b3d3ff66f75 100644 --- a/src/backend/regex/regc_lex.c +++ b/src/backend/regex/regc_lex.c @@ -616,7 +616,11 @@ lexescape(struct vars *v) assert(!ATEOS()); c = *v->now++; - if (!iscalnum(c)) + + /* if it's not alphanumeric ASCII, treat it as a plain character */ + if (!('a' <= c && c <= 'z') && + !('A' <= c && c <= 'Z') && + !('0' <= c && c <= '9')) RETV(PLAIN, c); NOTE(REG_UNONPOSIX); @@ -758,8 +762,11 @@ lexescape(struct vars *v) RETV(PLAIN, c); break; default: - assert(iscalpha(c)); - FAILW(REG_EESCAPE); /* unknown alphabetic escape */ + /* + * Throw an error for unrecognized ASCII alpha escape sequences, + * which reserves them for future use if needed. + */ + FAILW(REG_EESCAPE); break; } assert(NOTREACHED);