14 lines
327 B
Text
14 lines
327 B
Text
create or replace function list_join(lst, joiner) as (
|
|
with recursive cte as (
|
|
select 0 as ix, '' as s
|
|
union all
|
|
select ix+1 as ix,
|
|
if (s = '', '', s || joiner) || lst[ix+1]::VARCHAR) as s
|
|
from cte
|
|
where ix < length(lst)
|
|
)
|
|
select last(s)
|
|
from cte
|
|
);
|
|
|
|
select list_join(range(1,11), ', ');
|