Merge pull request #13 from fleetside72/import_error
update import function to trap all error at the end
This commit is contained in:
commit
204afa8643
@ -484,24 +484,7 @@ BEGIN
|
|||||||
|
|
||||||
--RAISE NOTICE '%', _t;
|
--RAISE NOTICE '%', _t;
|
||||||
|
|
||||||
BEGIN
|
EXECUTE _t;
|
||||||
EXECUTE _t;
|
|
||||||
EXCEPTION WHEN OTHERS THEN
|
|
||||||
GET STACKED DIAGNOSTICS
|
|
||||||
_MESSAGE_TEXT = MESSAGE_TEXT,
|
|
||||||
_PG_EXCEPTION_DETAIL = PG_EXCEPTION_DETAIL,
|
|
||||||
_PG_EXCEPTION_HINT = PG_EXCEPTION_HINT;
|
|
||||||
_message:=
|
|
||||||
($$
|
|
||||||
{
|
|
||||||
"status":"fail",
|
|
||||||
"message":"error importing data"
|
|
||||||
}
|
|
||||||
$$::jsonb)
|
|
||||||
||jsonb_build_object('message_text',_MESSAGE_TEXT)
|
|
||||||
||jsonb_build_object('pg_exception_detail',_PG_EXCEPTION_DETAIL);
|
|
||||||
return _message;
|
|
||||||
END;
|
|
||||||
|
|
||||||
WITH
|
WITH
|
||||||
|
|
||||||
@ -646,7 +629,23 @@ BEGIN
|
|||||||
)||jsonb_build_object('details',_log_info);
|
)||jsonb_build_object('details',_log_info);
|
||||||
|
|
||||||
RETURN _message;
|
RETURN _message;
|
||||||
END
|
|
||||||
|
EXCEPTION WHEN OTHERS THEN
|
||||||
|
GET STACKED DIAGNOSTICS
|
||||||
|
_MESSAGE_TEXT = MESSAGE_TEXT,
|
||||||
|
_PG_EXCEPTION_DETAIL = PG_EXCEPTION_DETAIL,
|
||||||
|
_PG_EXCEPTION_HINT = PG_EXCEPTION_HINT;
|
||||||
|
_message:=
|
||||||
|
($$
|
||||||
|
{
|
||||||
|
"status":"fail",
|
||||||
|
"message":"error importing data"
|
||||||
|
}
|
||||||
|
$$::jsonb)
|
||||||
|
||jsonb_build_object('message_text',_MESSAGE_TEXT)
|
||||||
|
||jsonb_build_object('pg_exception_detail',_PG_EXCEPTION_DETAIL);
|
||||||
|
return _message;
|
||||||
|
END;
|
||||||
$_$;
|
$_$;
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,24 +89,7 @@ BEGIN
|
|||||||
|
|
||||||
--RAISE NOTICE '%', _t;
|
--RAISE NOTICE '%', _t;
|
||||||
|
|
||||||
BEGIN
|
EXECUTE _t;
|
||||||
EXECUTE _t;
|
|
||||||
EXCEPTION WHEN OTHERS THEN
|
|
||||||
GET STACKED DIAGNOSTICS
|
|
||||||
_MESSAGE_TEXT = MESSAGE_TEXT,
|
|
||||||
_PG_EXCEPTION_DETAIL = PG_EXCEPTION_DETAIL,
|
|
||||||
_PG_EXCEPTION_HINT = PG_EXCEPTION_HINT;
|
|
||||||
_message:=
|
|
||||||
($$
|
|
||||||
{
|
|
||||||
"status":"fail",
|
|
||||||
"message":"error importing data"
|
|
||||||
}
|
|
||||||
$$::jsonb)
|
|
||||||
||jsonb_build_object('message_text',_MESSAGE_TEXT)
|
|
||||||
||jsonb_build_object('pg_exception_detail',_PG_EXCEPTION_DETAIL);
|
|
||||||
return _message;
|
|
||||||
END;
|
|
||||||
|
|
||||||
WITH
|
WITH
|
||||||
|
|
||||||
@ -251,7 +234,23 @@ BEGIN
|
|||||||
)||jsonb_build_object('details',_log_info);
|
)||jsonb_build_object('details',_log_info);
|
||||||
|
|
||||||
RETURN _message;
|
RETURN _message;
|
||||||
END
|
|
||||||
|
EXCEPTION WHEN OTHERS THEN
|
||||||
|
GET STACKED DIAGNOSTICS
|
||||||
|
_MESSAGE_TEXT = MESSAGE_TEXT,
|
||||||
|
_PG_EXCEPTION_DETAIL = PG_EXCEPTION_DETAIL,
|
||||||
|
_PG_EXCEPTION_HINT = PG_EXCEPTION_HINT;
|
||||||
|
_message:=
|
||||||
|
($$
|
||||||
|
{
|
||||||
|
"status":"fail",
|
||||||
|
"message":"error importing data"
|
||||||
|
}
|
||||||
|
$$::jsonb)
|
||||||
|
||jsonb_build_object('message_text',_MESSAGE_TEXT)
|
||||||
|
||jsonb_build_object('pg_exception_detail',_PG_EXCEPTION_DETAIL);
|
||||||
|
return _message;
|
||||||
|
END;
|
||||||
$f$
|
$f$
|
||||||
LANGUAGE plpgsql
|
LANGUAGE plpgsql
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user