Re: BUG #4436: (E'\\' LIKE E'\\') => f

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #4436: (E'\\' LIKE E'\\') => f
Дата
Msg-id 4016.1222394071@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #4436: (E'\\' LIKE E'\\') => f  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-bugs
Bruce Momjian <bruce@momjian.us> writes:
> Tom Lane wrote:
>> Yeah.  The given case is actually an invalid LIKE pattern.  I wonder
>> whether we should make LIKE throw error for an invalid pattern.

> Yes, I think we should throw an error;  the original query looked odd to
> me too.

A quick check in the standard supports the idea of throwing an error.
In fact, SQL92 saith

             ii) If there is not a partitioning of the string P into sub-
                 strings such that each substring has length 1 or 2, no
                 substring of length 1 is the escape character E, and each
                 substring of length 2 is the escape character E followed by
                 either the escape character E, an <underscore> character,
                 or the <percent> character, then an exception condition is
                 raised: data exception-invalid escape sequence.

which not only requires E to not be the last character, but says that
it's a bug to escape anything but % _ or the escape character.  That
last part is too anal for me, but it does seem we're on safe ground to
throw error for escape with nothing to escape.  I'll go make it so.

            regards, tom lane

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

Предыдущее
От: "Alex Hunsaker"
Дата:
Сообщение: Re: Incorrect "invalid AM/PM string" error from to_timestamp
Следующее
От: austijc
Дата:
Сообщение: ERROR: unexpected data beyond EOF in block XXXXX of relation "file"