Add diagnostics info to rest of cases #314

This commit is contained in:
Rafa de la Torre 2016-12-14 10:35:44 +01:00
parent 610cfaab57
commit cd653bc496

View File

@ -27,7 +27,10 @@ BEGIN
SELECT * FROM <%= DATASERVICES_CLIENT_SCHEMA %>._<%= name %>(<%= ['username', 'orgname'].concat(params).join(', ') %>); SELECT * FROM <%= DATASERVICES_CLIENT_SCHEMA %>._<%= name %>(<%= ['username', 'orgname'].concat(params).join(', ') %>);
EXCEPTION EXCEPTION
WHEN OTHERS THEN WHEN OTHERS THEN
RAISE WARNING 'whatever'; GET STACKED DIAGNOSTICS _returned_sqlstate = RETURNED_SQLSTATE,
_message_text = MESSAGE_TEXT,
_pg_exception_context = PG_EXCEPTION_CONTEXT;
RAISE WARNING USING ERRCODE = _returned_sqlstate, MESSAGE = _message_text, DETAIL = _pg_exception_context;
END; END;
<% elsif multi_field %> <% elsif multi_field %>
BEGIN BEGIN
@ -47,7 +50,10 @@ BEGIN
RETURN ret; RETURN ret;
EXCEPTION EXCEPTION
WHEN OTHERS THEN WHEN OTHERS THEN
RAISE WARNING 'whatever'; GET STACKED DIAGNOSTICS _returned_sqlstate = RETURNED_SQLSTATE,
_message_text = MESSAGE_TEXT,
_pg_exception_context = PG_EXCEPTION_CONTEXT;
RAISE WARNING USING ERRCODE = _returned_sqlstate, MESSAGE = _message_text, DETAIL = _pg_exception_context;
RETURN ret; RETURN ret;
END; END;
<% end %> <% end %>