merge from c9

This commit is contained in:
Paul Trowbridge 2017-10-18 01:45:44 -04:00
commit c582d5f176
2 changed files with 2107 additions and 1 deletions

View File

@ -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\dc.csv'' WITH (HEADER TRUE,DELIMITER '','', FORMAT CSV, ENCODING ''SQL_ASCII'',QUOTE ''"'');',_c); _t := format('COPY csv_i (%s) FROM ''C:\Users\fleet\downloads\dfs.csv'' WITH (HEADER TRUE,DELIMITER '','', FORMAT CSV, ENCODING ''SQL_ASCII'',QUOTE ''"'');',_c);
--RAISE NOTICE '%', _t; --RAISE NOTICE '%', _t;
@ -55,7 +55,11 @@ WITH pending_list AS (
(ae.e::text[])[1], --the key name (ae.e::text[])[1], --the key name
(row_to_json(i)::jsonb) #> ae.e::text[] --get the target value from the key from the csv row that has been converted to json (row_to_json(i)::jsonb) #> ae.e::text[] --get the target value from the key from the csv row that has been converted to json
) json_key, ) json_key,
<<<<<<< HEAD
row_to_json(i)::JSONB rec, row_to_json(i)::JSONB rec,
=======
row_to_json(i)::JSONB - 'id' rec,
>>>>>>> c9
srce, srce,
--ae.rn, --ae.rn,
id id
@ -87,7 +91,10 @@ WITH pending_list AS (
t IS NULL t IS NULL
----this conflict is only if an exact duplicate rec json happens, which will be rejected ----this conflict is only if an exact duplicate rec json happens, which will be rejected
----therefore, records may not be inserted due to ay matches with certain json fields, or if the entire json is a duplicate, reason is not specified ----therefore, records may not be inserted due to ay matches with certain json fields, or if the entire json is a duplicate, reason is not specified
<<<<<<< HEAD
ON CONFLICT ON CONSTRAINT uc_rec DO NOTHING ON CONFLICT ON CONSTRAINT uc_rec DO NOTHING
=======
>>>>>>> c9
RETURNING * RETURNING *
) )

File diff suppressed because it is too large Load Diff