get rid of insert

This commit is contained in:
Paul Trowbridge 2017-10-15 13:05:20 -04:00
parent f6ab0e42f5
commit 8bbf575f93

View File

@ -1,10 +1,10 @@
DO $$ DO $$
declare _t text; DECLARE _t text;
declare _c text; DECLARE _c text;
begin BEGIN
----------------------------------------------------build the column list of the temp table---------------------------------------------------------------- ----------------------------------------------------build the column list of the temp table----------------------------------------------------------------
@ -43,10 +43,12 @@ begin
EXECUTE _t; EXECUTE _t;
end END
$$; $$;
--*******************************************
--this needs to aggregate on id sequence --this needs to aggregate on id sequence
--*******************************************
SELECT SELECT
jsonb_build_object( jsonb_build_object(
(ae.e::text[])[1], --the key name (ae.e::text[])[1], --the key name
@ -59,11 +61,4 @@ FROM
csv_i i csv_i i
INNER JOIN tps.srce s ON INNER JOIN tps.srce s ON
s.srce = 'DCARD' s.srce = 'DCARD'
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;
/*
INSERT INTO
tps.trans (srce, rec)
SELECT
'DCARD', row_to_json(csv_i) FROM csv_i;
*/