From ae1a32baa75c25dc4aac415b5d80f14cdc533708 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 22 Oct 2020 11:50:15 -0400 Subject: [PATCH] rename column --- sql/build_master_tables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/build_master_tables.sql b/sql/build_master_tables.sql index 51d6633..85b4ace 100644 --- a/sql/build_master_tables.sql +++ b/sql/build_master_tables.sql @@ -12,7 +12,7 @@ BEGIN string_agg(cname || ' ' || dtype,', ' ORDER BY opos ASC) || ', PRIMARY KEY ('||string_agg(cname,', ') FILTER (WHERE fkey = func)||'));' AS ddl, ---need to add a clause to exclude where the key is null - 'INSERT INTO fc.'||func||' SELECT DISTINCT ' || string_agg(cname,', ' ORDER BY opos ASC) || ' FROM rlarp.osm_dev WHERE '||string_agg(cname,'||') FILTER (WHERE fkey = func)||' IS NOT NULL ON CONFLICT DO NOTHING' AS populate + 'INSERT INTO fc.'||func||' SELECT DISTINCT ' || string_agg(cname,', ' ORDER BY opos ASC) || ' FROM rlarp.osm_dev WHERE '||string_agg(cname,'||') FILTER (WHERE fkey = func)||' IS NOT NULL ON CONFLICT DO NOTHING' AS pop FROM fc.target_meta WHERE @@ -21,7 +21,7 @@ BEGIN func loop EXECUTE format('%s',f.ddl); - EXECUTE format('%s',f.populate); + EXECUTE format('%s',f.pop); END LOOP; END; $$