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