From 8bbf575f93c6756c8f8bb7490fb6d94a00ef98f0 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Sun, 15 Oct 2017 13:05:20 -0400 Subject: [PATCH] get rid of insert --- srce.pgsql | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/srce.pgsql b/srce.pgsql index 74152bc..05bb9d2 100644 --- a/srce.pgsql +++ b/srce.pgsql @@ -1,10 +1,10 @@ DO $$ -declare _t text; -declare _c text; +DECLARE _t text; +DECLARE _c text; -begin +BEGIN ----------------------------------------------------build the column list of the temp table---------------------------------------------------------------- @@ -43,10 +43,12 @@ begin EXECUTE _t; -end +END $$; +--******************************************* --this needs to aggregate on id sequence +--******************************************* SELECT jsonb_build_object( (ae.e::text[])[1], --the key name @@ -59,11 +61,4 @@ FROM csv_i i INNER JOIN tps.srce s ON s.srce = 'DCARD' - 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; -*/ \ No newline at end of file + LEFT JOIN LATERAL JSONB_ARRAY_ELEMENTS_TEXT(defn->'unique_constraint'->'fields') WITH ORDINALITY ae(e, rn) ON TRUE; \ No newline at end of file