Re: [SQL] inconsistent functionality with LIKE operator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Phuong Ma <pma(at)commandprompt(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] inconsistent functionality with LIKE operator
Date: 2001-03-29 16:43:43
Message-ID: 22657.985884223@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Phuong Ma <pma(at)commandprompt(dot)com> writes:
> 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%';

I think you need four backslashes. The string-literal parser eats one
level of backslashes, but you need the pattern that arrives at LIKE
to look like "a\\b%".

BTW, "PostgreSQL version 7.1" does not exist yet.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vilson farias 2001-03-29 16:48:07 Re: VARCHAR and TEXT
Previous Message Martín Marqués 2001-03-29 16:37:37 database dirs very stange on solaris

Browse pgsql-sql by date

  From Date Subject
Next Message Cedar Cox 2001-03-29 16:48:30 Re: Escaping \
Previous Message Tom Lane 2001-03-29 16:05:47 Re: Escaping \