Sunday, 8 September 2013

Expand parts of url into rows

Expand parts of url into rows

its possible when parsing string "projects/project/23" expand it into this
result:
projects
projects/project
projects/project/23
I think that I can use lag/lead window functions and make this SQL query:
select lag(unnest, 1, '') OVER () || '/' || unnest AS unnest
from unnest(string_to_array('projects/project/23', '/'))
but it doesnt work. How to make it?
Tnak you.

No comments:

Post a Comment