diff --git a/setup_sql/01_sample.sql b/setup_sql/01_sample.sql new file mode 100644 index 0000000..eec4952 --- /dev/null +++ b/setup_sql/01_sample.sql @@ -0,0 +1 @@ +CREATE TABLE fc.dcard AS (SELECT * FROM tpsv.dcard_mapped) WITH DATA; diff --git a/setup_sql/01_schema.sql b/setup_sql/01_schema.sql index 92caf22..ec666d3 100644 --- a/setup_sql/01_schema.sql +++ b/setup_sql/01_schema.sql @@ -1,6 +1,5 @@ DROP SCHEMA fc CASCADE; CREATE SCHEMA IF NOT EXISTS fc; -CREATE TABLE fc.dcard AS (SELECT * FROM tpsv.dcard_mapped) WITH DATA; --DROP TABLE IF EXISTS fc.target_meta; CREATE TABLE IF NOT EXISTS fc.target_meta ( diff --git a/setup_sql/03_build_master_tables.sql b/setup_sql/03_build_master_tables.sql index 021d8a8..44979b8 100644 --- a/setup_sql/03_build_master_tables.sql +++ b/setup_sql/03_build_master_tables.sql @@ -36,7 +36,7 @@ BEGIN --HAVING -- string_agg(cname,', ') FILTER (WHERE fkey = func) <> '' loop - INSERT INTO fc.sql SELECT f.func, f.ddl ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t; + INSERT INTO fc.sql SELECT _target_table, 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);