Re: non-static LIKE patterns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: patrick keshishian <pkeshish(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: non-static LIKE patterns
Date: 2012-04-11 23:07:28
Message-ID: 13003.1334185648@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dick Wieland 2012-04-11 23:54:26 Re: Pg 9.1.3 pg_crypto question
Previous Message patrick keshishian 2012-04-11 22:08:34 non-static LIKE patterns