pivot_forecast/setup_sql/02_target_info.sql

26 lines
510 B
PL/PgSQL

BEGIN;
INSERT INTO
fc.target_meta
SELECT
table_schema
,table_name
,column_name
,ordinal_position
,null::text func
,null::text fkey --foreign key to a master table
,null::text fcol
,data_type::text dtype
,null::text appcol
,null::text pretty
FROM
information_schema.columns
WHERE
table_name = 'dcard'
AND table_schema = 'tpsv'
ON CONFLICT ON CONSTRAINT target_meta_pk DO UPDATE SET
opos = EXCLUDED.opos
,dtype = EXCLUDED.dtype;
END;