feature #4: create function for constitution and title (not article in title)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
create or replace function find_constitution_titles_by_id(in constitution_id uuid, out resource json) language plpgsql as
|
||||
$$
|
||||
declare
|
||||
_constitution_id alias for constitution_id;
|
||||
begin
|
||||
select json_agg(t)
|
||||
from (
|
||||
select
|
||||
ti.id,
|
||||
ti.name,
|
||||
ti.rank
|
||||
into resource
|
||||
from title as ti
|
||||
where ti.constitution_id = _constitution_id
|
||||
order by ti.rank
|
||||
) as t;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- drop function if exists find_constitution_titles_by_id(uuid, out json);
|
||||
Reference in New Issue
Block a user