update fspr to show roll was done

This commit is contained in:
Paul Trowbridge 2018-09-25 13:47:37 -04:00
parent 2374b060bd
commit 5ce69011c4

View File

@ -84,6 +84,7 @@ BEGIN
) )
select * from rf select * from rf
) )
,ins AS (
INSERT INTO INSERT INTO
evt.bal evt.bal
SELECT SELECT
@ -99,6 +100,22 @@ BEGIN
obal = EXCLUDED.obal obal = EXCLUDED.obal
,debits = EXCLUDED.debits ,debits = EXCLUDED.debits
,credits = EXCLUDED.credits ,credits = EXCLUDED.credits
,cbal = EXCLUDED.cbal; ,cbal = EXCLUDED.cbal
RETURNING *
)
,touched AS (
SELECT DISTINCT
fspr
FROM
ins
)
UPDATE
evt.fspr f
SET
prop = f.prop || '{"rf":"global"}'::jsonb
FROM
touched t
WHERE
t.fspr = f.id;
END; END;
$func$; $func$;