Re: [GENERAL] non-static LIKE patterns

2012-04-13 Thread hamann . w
>> >> haman...@t-online.de writes: >> > Tom Lane wrote: >> > If you want it to be bulletproof, what I'd think about is something like >> >WHERE second.path LIKE quote_like(first.path)||'%' >> >> > Just out of curiosity: wouldn't that (as well as using non-static like) >> > be an enormous perf

Re: [GENERAL] non-static LIKE patterns

2012-04-12 Thread Tom Lane
haman...@t-online.de writes: > Tom Lane wrote: > If you want it to be bulletproof, what I'd think about is something like > WHERE second.path LIKE quote_like(first.path)||'%' > Just out of curiosity: wouldn't that (as well as using non-static like) > be an enormous performance problem? Well

Re: [GENERAL] non-static LIKE patterns

2012-04-11 Thread hamann . w
Tom Lane wrote: patrick keshishian 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 LI

Re: [GENERAL] non-static LIKE patterns

2012-04-11 Thread Tom Lane
patrick keshishian 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(firs

Re: [GENERAL] non-static LIKE patterns

2012-04-11 Thread patrick keshishian
On Wed, Apr 11, 2012 at 4:07 PM, Tom Lane wrote: > patrick keshishian 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 >

Re: [GENERAL] non-static LIKE patterns

2012-04-11 Thread Tom Lane
patrick keshishian 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-sl

[GENERAL] non-static LIKE patterns

2012-04-11 Thread patrick keshishian
Hi all, I'm sure this has been discussed before, but I am not too sure what key search-terms to use to find any potentially relevant discussions. Issue: I have two tables, each has a column that contains a directory path. First table contains a starting path and the second holds sub-paths (retain