inconsistent functionality with LIKE operator

From: Phuong Ma <pma(at)commandprompt(dot)com>
To: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: inconsistent functionality with LIKE operator
Date: 2001-03-29 08:25:30
Message-ID: 3AC2F17A.BFC50830@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

I'm using PostgreSQL version 7.1, and I'm having trouble with the LIKE
statement. How would I find the value "a\bc"? I tried using the
backslash to escape it: LIKE 'a\\b%';

If I specify: LIKE 'a\\bc', then it works, but if I wanted it to look
for consecetive characters after the c, using the %, then it returns
other values besides what I'm looking for.

I also have the same problem with percent (%). I have a test string
with the value "ab%c", and I want to look for that using LIKE. I tried:
LIKE 'ab\%c', LIKE 'ab%%', and LIKE 'ab\%_', but these statements not
only returned what I was looking for, but also other values:
"abc","ABC", and "Abc".

Phuong

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Mount 2001-03-29 08:29:28 Re: Bug in PostgreSQL JDBC Drive.
Previous Message Marcin Kowalski 2001-03-29 08:13:58 Re: pg_dump potential bug

Browse pgsql-sql by date

  From Date Subject
Next Message Marcin Kowalski 2001-03-29 08:35:06 Re: pg_dump potential bug -UNIQUE INDEX on PG_SHADOW Dont!! HELP
Previous Message Marcin Kowalski 2001-03-29 08:13:58 Re: pg_dump potential bug