Assert failure with ICU support

Richard Guo <guofenglinux@gmail.com>

From: Richard Guo <guofenglinux@gmail.com>
To: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Date: 2023-04-19T10:30:10Z
Lists: pgsql-bugs
I happened to run into an assert failure by chance with ICU support.
Here is the query:

    SELECT '1' SIMILAR TO '\൧';

The failure happens in lexescape(),

        default:
            assert(iscalpha(c));
            FAILW(REG_EESCAPE); /* unknown alphabetic escape */
            break;

Without ICU support, the same query just gives an error.

# SELECT '1' SIMILAR TO '\൧';
ERROR:  invalid regular expression: invalid escape \ sequence

FWIW, I googled a bit and '൧' seems to be number 1 in Malayalam.

Thanks
Richard

Commits

  1. Avoid character classification in regex escape parsing.