Re: BUG #6314: The like command does not handle a long string of special chars

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #6314: The like command does not handle a long string of special chars
Дата
Msg-id 8577.1322762881@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #6314: The like command does not handle a long string of special chars  (d.rericha@healthcareoss.com)
Ответы Re: BUG #6314: The like command does not handle a long string of special chars  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-bugs
d.rericha@healthcareoss.com writes:
> Simply set a varchar field in your db to the following string:
> !"#$%'()*+,-/:;=?@[\]^_`{|}~0000&<>

> I know, I know, who would do this, right? Well, its for a certification.
> The like command works fine up with escapes up to:
> !"#$%''()*+,-/:;=?@[%

Doesn't match for me, rather unsurprisingly since this string contains
two occurrences of "'" not one.

> Notice, I added the % to the end. However, if you go any further - no
> matches:
> !"#$%''()*+,-/:;=?@[\\%
> Strangely, this works and shouldn't:
> !"#$%''()*+,-/:;=?@[\%

It's hard to tell for sure, since you've presented a garbled
interpretation of what you did rather than showing us exactly what you
did, but I'm suspecting the problem boils down to forgetting that
backslash is an escape character in Postgres string literals, and
also for LIKE itself.  You should reread the manual's discussion of
LIKE:
http://www.postgresql.org/docs/8.4/static/functions-matching.html

            regards, tom lane

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

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: BUG #6314: The like command does not handle a long string of special chars
Следующее
От: rep.dot.nop@gmail.com
Дата:
Сообщение: BUG #6315: FETCH NEXT :next ROWS ONLY fails