add jsonb aggregate inside evt

This commit is contained in:
Paul Trowbridge 2018-09-24 09:29:41 -04:00
parent e2e1fd6f04
commit 8f89cb98e7

View File

@ -128,7 +128,7 @@ CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
,(gl_line->>'amount')::numeric amount ,(gl_line->>'amount')::numeric amount
,gl_rownum ,gl_rownum
--aggregate all the path references back to the gl line --aggregate all the path references back to the gl line
,public.jsonb_concat(bpr_extract) bprkeys ,evt.jsonb_concat(bpr_extract) bprkeys
FROM FROM
full_ex full_ex
GROUP BY GROUP BY
@ -295,4 +295,29 @@ CREATE TRIGGER gl_insert
FOR EACH STATEMENT FOR EACH STATEMENT
EXECUTE PROCEDURE evt.gl_insert(); EXECUTE PROCEDURE evt.gl_insert();
------------------------json concetenate aggregate-------------------------------------------
CREATE OR REPLACE FUNCTION evt.jsonb_concat(
state jsonb,
concat jsonb)
RETURNS jsonb
LANGUAGE 'plpgsql'
AS $BODY$
BEGIN
--RAISE notice 'state is %', state;
--RAISE notice 'concat is %', concat;
RETURN state || concat;
END;
$BODY$;
CREATE AGGREGATE evt.jsonb_concat(jsonb) (
SFUNC=evt.jsonb_concat,
STYPE=jsonb,
INITCOND='{}'
);
COMMIT; COMMIT;