Ok. I've fixed all. I was mistakenly matching :y to :y

Thank you so much Jeremy.


On Thursday, October 11, 2018 at 9:31:06 PM UTC+3, genc wrote:
>
> Hi,
>
> I'm sorry my previous email was mistakenly wrong. This is the correct one. 
> I mixed up the queries.
>
>
> with recursive pattern(pattern) as (
>  select string_to_array('folder_2/SUB iso', '/') -- input
> ),
> full_paths as (
>  select id, base_folder_id, subject, 1 as idx
>  from folders
>  cross join pattern
>  where user_id = 24 and subject ILIKE pattern[1]
> union all
>  select x.id, x.base_folder_id, x.subject, idx+ 1
>  from folders as x
>  cross join pattern
>  inner join full_paths as y 
>  on x.base_folder_id = y.id 
>  and x.subject ILIKE pattern[idx+ 1]
> )
> select id, subject
> from full_paths
> cross join pattern
> where idx = cardinality(pattern)
>
>
> I couldn't transform this to Sequel properly. Is there any way to do this 
> or should do a function?
>
> Thanks,
> Gencer.
>

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
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