Add find_opinions.sql

This commit is contained in:
flecomte committed 2020-02-08 01:24:16 +01:00
1 parent 7742287884
commit 976f8fac6a
3 files changed
+24

No files matched your search

@@ -0,0 +1,19 @@
create or replace function find_opinions(out resource json)
language plpgsql as
$$
begin
select json_agg(t)
into resource
from (
select ol.*
from opinion_list ol
where ol.deleted_at <= now()
or ol.deleted_at is null
order by ol.name
) t;
end;
$$;
-- drop function if exists find_opinions();
-- select find_opinions();