17 lines
479 B
Text
17 lines
479 B
Text
create or replace function to_set(lst) as (
|
|
list_sort(list_distinct(lst))
|
|
);
|
|
|
|
create or replace function list_update(lst, i, value) as (
|
|
lst[1:i-1] || [value] || lst[i+1:]
|
|
);
|
|
|
|
# This will work even if set1 and set2 are just lists
|
|
create or replace function set_intersection(set1, set2) as (
|
|
list_sort(list_intersect(set1, set2))
|
|
);
|
|
|
|
# This will work even if set1 and set2 are just lists
|
|
create or replace function set_union(set1, set2) as (
|
|
to_set( ( set1 || set2 ) )
|
|
);
|