Re: non-static LIKE patterns - Mailing list pgsql-general

From Tom Lane
Subject Re: non-static LIKE patterns
Date
Msg-id 17774.1334190767@sss.pgh.pa.us
Whole thread Raw
In response to Re: non-static LIKE patterns  (patrick keshishian <pkeshish@gmail.com>)
List pgsql-general
patrick keshishian <pkeshish@gmail.com> writes:
> Thanks for the quick reply. Would be tough choosing another
> "reasonable" ESCAPE character while dealing with paths. Will think
> more about this.

If you want it to be bulletproof, what I'd think about is something like

    WHERE second.path LIKE quote_like(first.path)||'%'

where quote_like() is a function that inserts a backslash before each
backslash, percent, and underscore in the given value.  Probably not
hard to cons that up from regexp_replace().

            regards, tom lane

pgsql-general by date:

Previous
From: patrick keshishian
Date:
Subject: Re: non-static LIKE patterns
Next
From: Albretch Mueller
Date:
Subject: Any information about the PostgreSQL Certified Engineer program?