如何在Postgres中处理与db应用程序相关的错误和异常

时间:2017-09-21 14:00:04

标签: postgresql error-handling compiler-errors error-logging error-log

问题:46234035。

有一个函数blurb_stream() 我正在调用一个功能消息(我已经删除/不存在) 因此,为了捕获该错误,我在blurb_stream()中给出了异常块:

EXCEPTION WHEN others THEN 
    v_state   = RETURNED_SQLSTATE,
    v_msg1     = MESSAGE_TEXT,
    v_detail  = PG_EXCEPTION_DETAIL,
    v_hint    = PG_EXCEPTION_HINT,
    v_context = PG_EXCEPTION_CONTEXT;


 raise notice E'Got exception:
            state  : %
            message: %
            detail : %
            hint   : %
            context: %', v_state, v_msg1, v_detail, v_hint, v_context;

但不是提出这些错误,而是反映在控制台中:

ERROR:  function mobile.message(integer) does not exist
LINE 1: SELECT mobile.message(v_status)
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
QUERY:  SELECT mobile.message(v_status)
CONTEXT:  PL/pgSQL function mobile.blurb_stream(jsonb) line 190 at assignment
********** Error **********

ERROR: function mobile.message(integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Context: PL/pgSQL function mobile.blurb_stream(jsonb) line 190 at assignment

请帮忙继续。

0 个答案:

没有答案