Re: Improved regular expression error message for backrefs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Improved regular expression error message for backrefs
Дата
Msg-id 58295.1629686845@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Improved regular expression error message for backrefs  (Mark Dilger <mark.dilger@enterprisedb.com>)
Ответы Re: Improved regular expression error message for backrefs  (Mark Dilger <mark.dilger@enterprisedb.com>)
Список pgsql-hackers
Mark Dilger <mark.dilger@enterprisedb.com> 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,
ratherthan at the end of the list.  Is there a project preference to add it at the end?  Certainly, that would give a
shortergit diff. 
> Are there dependencies on the current error messages which prevent such changes?

Yeah: the POSIX standard says what the error codes from regcomp() are.

POSIX defines

    REG_ESUBREG
        Number in \digit invalid or in error.

which does seem to cover this case, so what I'd argue is that we should
improve the "invalid backreference number" text rather than invent
a nonstandard error code.  Maybe about like "backreference number does
not exist or cannot be referenced from here"?

(Admittedly, there's not a huge reason why src/backend/regex/ needs to
stay compliant with the POSIX API today.  But I still have ambitions to
split that out as a free-standing library someday, as Henry Spencer had
originally planned to do.  So I'd rather stick to the API spec.)

It might be worth checking what text is attributed to this error code
by PCRE and other implementations of the POSIX spec.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: .ready and .done files considered harmful
Следующее
От: li jie
Дата:
Сообщение: Re: Is it worth pushing conditions to sublink/subplan?