Re: [GENERAL] Escaping string for LIKE

2010-11-23 Thread Dmitriy Igrishin
Hey David, I guess, that you should escape, like this dmitigr=> SELECT regexp_replace('di_ma%', '(%|_)', E'\\1', 'g'); regexp_replace di\_ma\% 2010/11/23 David Sheldon > If I have a string, and I want to search for everything that starts with > that string then I could

[GENERAL] Escaping string for LIKE

2010-11-23 Thread David Sheldon
If I have a string, and I want to search for everything that starts with that string then I could do: SELECT * FROM users WHERE name LIKE string || '%'; Now, if string contains \, _ or % then it won't do what I expect. Is there a built-in function that I can call to escape the string so that