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;