Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-05 Thread Thomas Kellerer
Ryan Murphy schrieb am 05.09.2017 um 16:19: > Thanks, I saw that page earlier; what I'm looking for is kind of the > opposite - instead of comparing a single value to see if it matches > any of a list of patterns, I'm trying to take a list of values and > see if any of them match a given pattern. >

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-05 Thread Ryan Murphy
Thanks, I saw that page earlier; what I'm looking for is kind of the opposite - instead of comparing a single value to see if it matches any of a list of patterns, I'm trying to take a list of values and see if any of them match a given pattern. Best, Ryan On Tue, Sep 5, 2017 at 8:01 AM Hellmuth

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-05 Thread Hellmuth Vargas
Hi can see: https://stackoverflow.com/questions/4928054/postgresql-wildcard-like-for-any-of-a-list-of-words 2017-09-04 22:42 GMT-05:00 Ryan Murphy : > > I'm pretty sure it doesn't work syntactically. Don't recall the details > offhand. > > Ok, thanks! > -- Cordialmente, Ing. Hellmuth I. V

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Ryan Murphy
> I'm pretty sure it doesn't work syntactically. Don't recall the details offhand. Ok, thanks!

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Tom Lane
Ryan Murphy writes: > Interesting! It seems like one "simple" possiblity would be to allow ANY() > to be on either side...or would that muck up the Grammar too badly or have > weird edge cases where it doesn't make sense? I'm pretty sure it doesn't work syntactically. Don't recall the details of

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Ryan Murphy
> > I'm not sure why we've never got round to providing such a thing > in core ... probably lack of consensus on what to name the reverse > operator. You'd need to support regex cases as well, so there's > more than one operator name to come up with. > Interesting! It seems like one "simple" poss

Re: [GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Tom Lane
Ryan Murphy writes: > But is there any way to do: > select * from post > where any(tags) LIKE 'music%'; > ?? > This doesn't work because ANY is only allowed on the right. Yeah. The traditional answer is "make yourself a reverse LIKE operator, one that takes the pattern on the left". You can bru

[GENERAL] What's the best way in postgres to use ANY() with LIKE '%'?

2017-09-04 Thread Ryan Murphy
e.g. I know you can do select * from post where 'music' = any(tags); Which is similar to saying tags @> '{music}'. And I see that I can even do: select * from post where 'music' LIKE any(tags); ...implying that ANY is more general in some ways than @>, e.g. it can would with LIKE as well as =.