pgsql-bugs(at)postgresql(dot)org writes:
> The following pattern matches do not work:
> LIKE '%\_%'
> LIKE '%\_'
> LIKE '\_%'
You are short a backslash: what the LIKE operator is seeing is just
%_%, etc, which naturally matches anything. You gotta double the
backslashes, because one backslash will be eaten by the string-literal
parser.
regards, tom lane