On Thursday, May 10, 2018 at 4:07:28 AM UTC-7, [email protected] wrote:
>
> Hi Jeremy!
> I have small question related to filtering data with ilike function but by 
> the values returned from the subquery. Could you look if it might work:
>
> ```
> query = DB[:projects].select(Sequel.join(["Project$", :id], ''))
> DB[:events].select(:id).where(Sequel.like(:stream, query))
> ```
> It produces something like that:
> ```
> SELECT events.id 
> FROM events 
> WHERE (events.stream LIKE (SELECT ('Project$' || '' || id) FROM projects) 
> ESCAPE '\\')
> ``` And it doesn't work what is completly normal behaviour so i tried to 
> make it better
> `Sequel.like(:stream, query) => Sequel.like(:stream, 
> Sequel.pg_array_op(query).any)`
>
> but application gives me an error cause I cannot remove `ESCAPE '\\'` 
> part:
> ```
>
> SELECT events.id FROM events WHERE (events.stream ILIKE ANY((SELECT (
> 'Project$' || '' || id) FROM projects)) ESCAPE '\\')
> ```
>
>
> Do you have some idea how it should work properly?
>

What database are you using?

To use ANY, you could just do Sequel.like(:stream, Sequel.function(:ANY, 
query))

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to