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