diff --git a/build/build_pool.sql b/build/build_pool.sql index 11b49b4..6a4392b 100644 --- a/build/build_pool.sql +++ b/build/build_pool.sql @@ -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);