From d51a327868772ce18e7ebf79096cd81d9c1533d7 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 8 Feb 2018 17:40:23 -0500 Subject: [PATCH] add create function scripts --- functions/srce_edit.pgsql | 15 +++++++++++++++ .../{create_func_srce.pgsql => srce_import.pgsql} | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 functions/srce_edit.pgsql rename functions/{create_func_srce.pgsql => srce_import.pgsql} (96%) diff --git a/functions/srce_edit.pgsql b/functions/srce_edit.pgsql new file mode 100644 index 0000000..a5d05e0 --- /dev/null +++ b/functions/srce_edit.pgsql @@ -0,0 +1,15 @@ + +CREATE OR REPLACE FUNCTION tps.srce_set(_name text, _defn jsonb) RETURNS jsonb +AS $f$ +BEGIN + +/* +1. determine if insert or update +2. if update, determine if conflicts exists +3. do merge +*/ + + +END; +$f$ +LANGUAGE plpgsql diff --git a/functions/create_func_srce.pgsql b/functions/srce_import.pgsql similarity index 96% rename from functions/create_func_srce.pgsql rename to functions/srce_import.pgsql index d3b36f6..517d77e 100644 --- a/functions/create_func_srce.pgsql +++ b/functions/srce_import.pgsql @@ -1,6 +1,6 @@ \timing - -CREATE OR REPLACE FUNCTION tps.srce_edit(_path text, _srce text) RETURNS text +DROP FUNCTION tps.srce_import(_path text, _srce text); +CREATE OR REPLACE FUNCTION tps.srce_import(_path text, _srce text) RETURNS jsonb /*-------------------------------------------------------- 0. load target import to temp table @@ -11,6 +11,10 @@ CREATE OR REPLACE FUNCTION tps.srce_edit(_path text, _srce text) RETURNS text 5. insert summary to log table */--------------------------------------------------------- +--to-do +--return infomation to a client via json or composite type + + AS $f$ DECLARE _t text; DECLARE _c text;