On Fri, 12 Oct 2001 pgsql-bugs(at)postgresql(dot)org wrote:
> Tom Cross (decius(at)whack(dot)org) reports a bug with a severity of 2
> The lower the number the more severe it is.
>
> Short Description
> problem with LIKE pattern matches involving % and \_
>
> Long Description
> The following pattern matches do not work:
>
> LIKE '%\_%'
> LIKE '%\_'
> LIKE '\_%'
I think you need to double the backslashes, so
'%\\_%' searches for anything with an underscore.