pivot_forecast/sql/target_info.sql

24 lines
490 B
MySQL
Raw Normal View History

BEGIN;
INSERT INTO
fc.target_meta
SELECT
table_schema||'.'||table_name
,column_name
,ordinal_position
,'doc'::text func
,null::text fkey --foreign key to a master table
,null::text pretty
,data_type::text dtype
,column_name mastcol
FROM
information_schema.columns
WHERE
2020-10-22 23:08:11 -04:00
table_name = 'live'
AND table_schema = 'fc'
ON CONFLICT ON CONSTRAINT target_meta_pk DO UPDATE SET
opos = EXCLUDED.opos
,dtype = EXCLUDED.dtype;
END;