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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: BUG #4436: (E'\\' LIKE E'\\') => f
Дата
Msg-id 200809252057.m8PKvr521890@momjian.us
обсуждение исходный текст
Ответ на Re: BUG #4436: (E'\\' LIKE E'\\') => f  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: BUG #4436: (E'\\' LIKE E'\\') => f  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Mathieu Fenniak wrote:
> >> I noticed that (SELECT E'\\' LIKE E'\\') returns false,
>
> > I believe this is caused because backslash is the default escape
> > character for LIKE, so you need:
> >     test=> SELECT E'\\' LIKE E'\\\\';
>
> Yeah.  The given case is actually an invalid LIKE pattern.  I wonder
> whether we should make LIKE throw error for an invalid pattern.
> You get an error for the corresponding case in regex:
>
> regression=# select E'\\' ~ E'\\';
> ERROR:  invalid regular expression: invalid escape \ sequence
>
> but IIRC the LIKE code just silently ignores a trailing escape
> character.

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

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: [ADMIN] Postgres Stats after Crash Recovery
Следующее
От: "Alex Hunsaker"
Дата:
Сообщение: Re: Incorrect "invalid AM/PM string" error from to_timestamp