Re: = or LIKE ?

Поиск
Список
Период
Сортировка
От Jesper Krogh
Тема Re: = or LIKE ?
Дата
Msg-id 49986AF2.4010206@krogh.cc
обсуждение исходный текст
Ответ на Re: = or LIKE ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: = or LIKE ?  (Jesper Krogh <jesper@krogh.cc>)
Re: = or LIKE ?  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-sql
Tom Lane wrote:
> Jesper Krogh <jesper@krogh.cc> writes:
>> Shouldnt the like operator do the same as the = if there occours no 
>> wildcards and stuff in the string?
> 
> If there are also no escape characters, then yeah.
> 
> FWIW, 8.4 will complain about this case:
> 
> regression=# select E'\\' like E'\\';
> ERROR:  LIKE pattern must not end with escape character

So I cannot rely on the like operator to behave correct if I'd like to 
compare strings with backslashes (e.g. filepaths from MS Windows 
filesystems)?

I actually get the same if it doesnt end with the slashes:
testdb=# select E'\\t' like E'\\t'; ?column?
---------- f
(1 row)

testdb=# select E'\\t' = E'\\t'; ?column?
---------- t
(1 row)



-- 
Jesper


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: = or LIKE ?
Следующее
От: Jesper Krogh
Дата:
Сообщение: Re: = or LIKE ?