core: Underscores in tag names break tags

Since '_' is treated in Postgres as '?' when using like, (i.e. match
any single character)
we have to escape this character in the value to make it
treated as a regular character.
Due to changes between PG8.x and PG9.x on ESCAPE
representation in a string, we should
figure out what PG Release is running in order to escape
the special character(_) correctly

The bug was that the above treatment was done on the value no matter
what the operator is, while this change should be applied only for the
LIKE or ILIKE operator. If the operator is '=' '!=' 'IN' etc. the '_'
should stay as is in the passed value and not been manipulated.

Change-Id: Ia4c289e198b59afc4acf3e671ea65f2cdf8e31ad
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=949484
Signed-off-by: Eli Mesika <emesika@redhat.com>