feature #4: create function for constitution and title (not article in title)
This commit is contained in:
19
resources/functions/constitution/find_constitution_by_id.sql
Normal file
19
resources/functions/constitution/find_constitution_by_id.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
create or replace function find_constitution_by_id(in id uuid, out resource json) language plpgsql as
|
||||
$$
|
||||
declare
|
||||
_id alias for id;
|
||||
begin
|
||||
select to_json(t)
|
||||
from (
|
||||
select
|
||||
c.*,
|
||||
find_citizen_by_id(c.created_by_id) as created_by,
|
||||
find_constitution_titles_by_id(c.id) as titles
|
||||
into resource
|
||||
from constitution as c
|
||||
where c.id = _id
|
||||
) as t;
|
||||
end;
|
||||
$$;
|
||||
|
||||
-- drop function if exists find_constitution_by_id(uuid, out json);
|
||||
Reference in New Issue
Block a user