switch to PNCC

This commit is contained in:
Paul Trowbridge 2017-10-18 14:11:57 -04:00
parent 748d6ddb3c
commit 419017f98c

View File

@ -18,7 +18,7 @@ BEGIN
--unwrap the schema definition array --unwrap the schema definition array
LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE LEFT JOIN LATERAL jsonb_populate_recordset(null::tps.srce_defn_schema, defn->'schema') prs ON TRUE
WHERE WHERE
srce = 'DCARD' srce = 'PNCC'
GROUP BY GROUP BY
srce; srce;
@ -35,7 +35,7 @@ BEGIN
----------------------------------------------------do the insert------------------------------------------------------------------------------------------- ----------------------------------------------------do the insert-------------------------------------------------------------------------------------------
--the column list needs to be dynamic forcing this whole line to be dynamic --the column list needs to be dynamic forcing this whole line to be dynamic
_t := format('COPY csv_i (%s) FROM ''C:\Users\fleet\downloads\dfs.csv'' WITH (HEADER TRUE,DELIMITER '','', FORMAT CSV, ENCODING ''SQL_ASCII'',QUOTE ''"'');',_c); _t := format('COPY csv_i (%s) FROM ''C:\Users\ptrowbridge\downloads\transsearchcsv.csv'' WITH (HEADER TRUE,DELIMITER '','', FORMAT CSV, ENCODING ''SQL_ASCII'',QUOTE ''"'');',_c);
--RAISE NOTICE '%', _t; --RAISE NOTICE '%', _t;
@ -62,7 +62,7 @@ WITH pending_list AS (
FROM FROM
csv_i i csv_i i
INNER JOIN tps.srce s ON INNER JOIN tps.srce s ON
s.srce = 'DCARD' s.srce = 'PNCC'
LEFT JOIN LATERAL JSONB_ARRAY_ELEMENTS_TEXT(defn->'unique_constraint'->'fields') WITH ORDINALITY ae(e, rn) ON TRUE LEFT JOIN LATERAL JSONB_ARRAY_ELEMENTS_TEXT(defn->'unique_constraint'->'fields') WITH ORDINALITY ae(e, rn) ON TRUE
GROUP BY GROUP BY
i.*, i.*,