rename column

This commit is contained in:
Paul Trowbridge 2020-10-22 11:50:15 -04:00
parent 511a38faf9
commit ae1a32baa7

View File

@ -12,7 +12,7 @@ BEGIN
string_agg(cname || ' ' || dtype,', ' ORDER BY opos ASC) || string_agg(cname || ' ' || dtype,', ' ORDER BY opos ASC) ||
', PRIMARY KEY ('||string_agg(cname,', ') FILTER (WHERE fkey = func)||'));' AS ddl, ', PRIMARY KEY ('||string_agg(cname,', ') FILTER (WHERE fkey = func)||'));' AS ddl,
---need to add a clause to exclude where the key is null ---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 FROM
fc.target_meta fc.target_meta
WHERE WHERE
@ -21,7 +21,7 @@ BEGIN
func func
loop loop
EXECUTE format('%s',f.ddl); EXECUTE format('%s',f.ddl);
EXECUTE format('%s',f.populate); EXECUTE format('%s',f.pop);
END LOOP; END LOOP;
END; END;
$$ $$