Re: [BUGS] BUG #14512: Backslashes in LIKE

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: [BUGS] BUG #14512: Backslashes in LIKE
Дата
Msg-id CAKFQuwacdGqhc8DY6baKqDNSFi1JgUL0Jt24vd0vF9s6P1Yyag@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14512: Backslashes in LIKE  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [BUGS] BUG #14512: Backslashes in LIKE  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [BUGS] BUG #14512: Backslashes in LIKE  (Vojtěch Rylko <vojta.rylko@gmail.com>)
Список pgsql-bugs
On Tue, Jan 24, 2017 at 11:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
vojta.rylko@gmail.com writes:
> Hi, LIKE behaves differently depending on left side.

>> select 1 where '\' like '\\\'; -- one and three backslashes
>  ?column?
> ----------
> (0 rows)

>> select 1 where '\\' like '\\\'; -- two and three backslashes
> ERROR:  LIKE pattern must not end with escape character

I see no bug here.  The pattern is wrong, but it happens not to notice in
the first case because it never reaches the buggy part of the pattern.

Then consider a feature request that a malformed pattern be detected and fail independent of the data being checked. Such non-deterministic failure is at least a POLA violation and makes what should be a basically compile-time error into a run-time one.

I will agree that It is not a back-patchable bug (unless we decide to never fail and instead have a malformed pattern always return false - we'd at least be consistent - though probably not in a desirable way)  but would say it is a defect that should be addressed in v10.

David J.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14512: Backslashes in LIKE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [BUGS] BUG #14512: Backslashes in LIKE