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-12 00:32:47
Message-ID: 17774.1334190767@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:
> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albretch Mueller 2012-04-12 04:51:17 Any information about the PostgreSQL Certified Engineer program?
Previous Message patrick keshishian 2012-04-12 00:27:03 Re: non-static LIKE patterns