Re: non-static LIKE patterns

From: patrick keshishian <pkeshish(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: non-static LIKE patterns
Date: 2012-04-12 00:27:03
Message-ID: CAN0yQBpno-5G3y4zhBdqTCNeNw+S6jM1HAMjWbtcGAkhAcEb1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 11, 2012 at 4:07 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> patrick keshishian <pkeshish(at)gmail(dot)com> writes:
>> I need to match entries in second table to the first, so I use the
>> following in my WHERE clause:
>>       ... WHERE second.path LIKE first.path||'%'
>> This seemed to work at first, but it fails if the paths use
>> back-slashes (like Windows paths).
>
> By default, back-slash is a special character in LIKE patterns.
> You can change that with the ESCAPE option.  See
> http://www.postgresql.org/docs/devel/static/functions-matching.html#FUNCTIONS-LIKE

Thanks for the quick reply. Would be tough choosing another
"reasonable" ESCAPE character while dealing with paths. Will think
more about this.

Cheers,
--patrick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-04-12 00:32:47 Re: non-static LIKE patterns
Previous Message Dick Wieland 2012-04-11 23:54:26 Re: Pg 9.1.3 pg_crypto question