Craig Ringer <craig@xxxxxxxxxxxxxxxxxxxxx> 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