update pool component to reset the log file and sequence for a new forecast

This commit is contained in:
Paul Trowbridge 2021-07-12 15:34:50 -04:00
parent 5520337446
commit 1c5b17daa0

View File

@ -1,5 +1,11 @@
BEGIN;
--only do this when starting fresh
TRUNCATE TABLE rlarp.osm_pool;
TRUNCATE TABLE rlarp.osm_log CASCADE;
ALTER SEQUENCE rlarp.osm_log_id_seq RESTART 1;
DROP TABLE IF EXISTS rlarp.osm_pool_stage;
CREATE TABLE rlarp.osm_pool_stage AS (
@ -49,7 +55,7 @@ repc AS (
SELECT * FROM LGDAT.MMSL WHERE COALESCE(BSMNCD,'') <> ''
)
,logload AS (
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','merge actuals','type','build_pool','stamp',current_timestamp,'source','top level','message','don''t undo') RETURNING *
INSERT INTO rlarp.osm_log (doc) SELECT jsonb_build_object('user',current_user,'tag','1+11','type','build_pool','stamp',current_timestamp,'source','top level','message','don''t undo') RETURNING *
)
SELECT
fspr
@ -171,6 +177,7 @@ FROM
--LIMIT 100
) WITH DATA;
INSERT INTO rlarp.osm_pool SELECT * FROM rlarp.osm_pool_stage;
--CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr, bill_cust_descr, ship_cust_descr);