26 lines
516 B
PL/PgSQL
26 lines
516 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
|
|
,column_name fcol
|
|
,data_type::text dtype
|
|
,null::text appcol
|
|
,null::text pretty
|
|
FROM
|
|
information_schema.columns
|
|
WHERE
|
|
table_name = 'dcard_mapped'
|
|
AND table_schema = 'fc'
|
|
ON CONFLICT ON CONSTRAINT target_meta_pk DO UPDATE SET
|
|
opos = EXCLUDED.opos
|
|
,dtype = EXCLUDED.dtype;
|
|
|
|
END;
|