put sample data table in separate file and use target table in new table creation
This commit is contained in:
parent
4ae9a5becd
commit
898593c3a8
1
setup_sql/01_sample.sql
Normal file
1
setup_sql/01_sample.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
CREATE TABLE fc.dcard AS (SELECT * FROM tpsv.dcard_mapped) WITH DATA;
|
@ -1,6 +1,5 @@
|
|||||||
DROP SCHEMA fc CASCADE;
|
DROP SCHEMA fc CASCADE;
|
||||||
CREATE SCHEMA IF NOT EXISTS fc;
|
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;
|
--DROP TABLE IF EXISTS fc.target_meta;
|
||||||
CREATE TABLE IF NOT EXISTS fc.target_meta (
|
CREATE TABLE IF NOT EXISTS fc.target_meta (
|
||||||
|
@ -36,7 +36,7 @@ BEGIN
|
|||||||
--HAVING
|
--HAVING
|
||||||
-- string_agg(cname,', ') FILTER (WHERE fkey = func) <> ''
|
-- string_agg(cname,', ') FILTER (WHERE fkey = func) <> ''
|
||||||
loop
|
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.ddl);
|
||||||
EXECUTE format('%s',f.pop);
|
EXECUTE format('%s',f.pop);
|
||||||
EXECUTE format('%s',f.fk);
|
EXECUTE format('%s',f.fk);
|
||||||
|
Loading…
Reference in New Issue
Block a user