What I've tried so far:

.where(DB.select{jsonb_array_elements(send_to)}.exists)

But expected output is *SELECT 1* for example. Actual is only SELECT (..


On Sunday, May 26, 2019 at 8:11:41 PM UTC+3, xura wrote:
>
> One last question here. Sorry for my questions today! Actually two 
> question in one row.
>
> I have jsonb field which is like this:
>
> [
>  {
>   "name": "Mark",
>  },
>  {
>   "name": "John",
>  }
> ]
>
>
> As you can see objects are in single array. I want to search John for 
> example but i want to use regex like "jo*" or like "%jo%. Using PostgreSQL 
> 11.
>
> If I learn correctly, regex is not possible directly with* pg_json_op*. 
> If so, my question is how can i translate this line to Sequel? I am managed 
> to do *SELECT *part and json functions in there but failed on where part.
>
> select (some functions here done by me successfully) from emails where 
> EXISTS (SELECT 1 FROM jsonb_array_elements(to) as j(data) WHERE (data#>> 
> '{name}') LIKE '%jo%')
>
>
> Or is there any method in Sequel to help me to accomplish this task? What 
> is your suggestion?
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/28e9e885-d37c-45f9-a965-1dc866c873cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to