update fspr to show roll was done
This commit is contained in:
parent
2374b060bd
commit
5ce69011c4
@ -84,21 +84,38 @@ BEGIN
|
||||
)
|
||||
select * from rf
|
||||
)
|
||||
INSERT INTO
|
||||
evt.bal
|
||||
SELECT
|
||||
acct
|
||||
,id
|
||||
,obal
|
||||
,debits
|
||||
,credits
|
||||
,cbal
|
||||
,ins AS (
|
||||
INSERT INTO
|
||||
evt.bal
|
||||
SELECT
|
||||
acct
|
||||
,id
|
||||
,obal
|
||||
,debits
|
||||
,credits
|
||||
,cbal
|
||||
FROM
|
||||
bld
|
||||
ON CONFLICT ON CONSTRAINT bal_pk DO UPDATE SET
|
||||
obal = EXCLUDED.obal
|
||||
,debits = EXCLUDED.debits
|
||||
,credits = EXCLUDED.credits
|
||||
,cbal = EXCLUDED.cbal
|
||||
RETURNING *
|
||||
)
|
||||
,touched AS (
|
||||
SELECT DISTINCT
|
||||
fspr
|
||||
FROM
|
||||
ins
|
||||
)
|
||||
UPDATE
|
||||
evt.fspr f
|
||||
SET
|
||||
prop = f.prop || '{"rf":"global"}'::jsonb
|
||||
FROM
|
||||
bld
|
||||
ON CONFLICT ON CONSTRAINT bal_pk DO UPDATE SET
|
||||
obal = EXCLUDED.obal
|
||||
,debits = EXCLUDED.debits
|
||||
,credits = EXCLUDED.credits
|
||||
,cbal = EXCLUDED.cbal;
|
||||
touched t
|
||||
WHERE
|
||||
t.fspr = f.id;
|
||||
END;
|
||||
$func$;
|
Loading…
Reference in New Issue
Block a user