replace hardcoded table name to derive from target meta
This commit is contained in:
parent
860b34fad8
commit
ba93b6b84e
@ -14,12 +14,13 @@ BEGIN
|
|||||||
', PRIMARY KEY ('||string_agg(format('%I',cname),', ') FILTER (WHERE fkey = func)||'));' AS ddl,
|
', PRIMARY KEY ('||string_agg(format('%I',cname),', ') FILTER (WHERE fkey = func)||'));' AS ddl,
|
||||||
-------------------------------------------populate table-------------------------------------------------------------------------------------------------------
|
-------------------------------------------populate table-------------------------------------------------------------------------------------------------------
|
||||||
---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(format('%I',cname),', ' ORDER BY opos ASC) || ' FROM rlarp.osm_dev WHERE '||
|
'INSERT INTO fc.'||func||' SELECT DISTINCT ' || string_agg(format('%I',cname),', ' ORDER BY opos ASC) || ' FROM '||tname||' WHERE '||
|
||||||
string_agg(format('%I',cname)||' IS NOT NULL ',' AND ') FILTER (WHERE fkey = func)||' ON CONFLICT DO NOTHING' AS pop
|
string_agg(format('%I',cname)||' IS NOT NULL ',' AND ') FILTER (WHERE fkey = func)||' ON CONFLICT DO NOTHING' AS pop
|
||||||
FROM
|
FROM
|
||||||
fc.target_meta
|
fc.target_meta
|
||||||
GROUP BY
|
GROUP BY
|
||||||
func
|
tname
|
||||||
|
,func
|
||||||
HAVING
|
HAVING
|
||||||
string_agg(cname,', ') FILTER (WHERE fkey = func) <> ''
|
string_agg(cname,', ') FILTER (WHERE fkey = func) <> ''
|
||||||
loop
|
loop
|
||||||
|
Loading…
Reference in New Issue
Block a user