Re: Initial ugly reverse-translator

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Initial ugly reverse-translator
Дата
Msg-id 9370.1208619856@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Initial ugly reverse-translator  (Craig Ringer <craig@postnewspapers.com.au>)
Ответы Re: Initial ugly reverse-translator
Список pgsql-general
Craig Ringer <craig@postnewspapers.com.au> writes:
> It's also useful for format-string based messages, but more thought is
> needed on how best to handle them. A LIKE query using the format-string
> message as the pattern (after converting the pattern syntax to SQL
> style) would be (a) slow and (b) very sensitive to formatting and other
> variation. I haven't spent any time on that bit yet, but if anybody has
> any ideas I'd be glad to hear them.

I don't really see the problem.  I assume from your reference to pg_trgm
that you're using trigram similarity as the prefilter for potential
matches, so a slow final LIKE match shouldn't be an issue really.
(And besides, speed doesn't seem like the be-all and end-all here.)

AFAICS you just need to translate %-string format escapes to %, quote
any other % or _, and away you go.

One thing that might be worth doing is avoiding spacing sensitivity,
since whitespace is frequently mangled in copy-and-paste.  Perhaps
strip all spaces from both strings before matching?

            regards, tom lane

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: SQL error
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Initial ugly reverse-translator