From 64af23cf04bc8178b1e73e5633c20c5669c3234e Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 13 Apr 2022 01:15:40 -0400 Subject: [PATCH] do a merge instead of an insert --- setup_sql/03_build_master_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_sql/03_build_master_tables.sql b/setup_sql/03_build_master_tables.sql index b64a2f1..ff1721c 100644 --- a/setup_sql/03_build_master_tables.sql +++ b/setup_sql/03_build_master_tables.sql @@ -35,7 +35,7 @@ BEGIN --HAVING -- string_agg(cname,', ') FILTER (WHERE fkey = func) <> '' loop - INSERT INTO fc.sql SELECT f.func, f.ddl; + INSERT INTO fc.sql SELECT f.func, f.ddl ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t; EXECUTE format('%s',f.ddl); EXECUTE format('%s',f.pop); EXECUTE format('%s',f.fk);