简体   繁体   English

如何从 postgresql 中的引发异常中排除上下文

[英]How to exclude context from raise exception in postgresql

i want to throw error in function postgresql , but how if i want to exclude/remove the context from it errors?我想在 function postgresql中抛出错误,但是如果我想从中排除/删除上下文错误怎么办?

what i try so far到目前为止我尝试了什么

RAISE 'messages error here (%) and here', NEW.request
      USING HINT = 'hint messages here';

i got return message error , hint and context ..我收到返回message errorhintcontext ..

SQLSTATE[P0001]: Raise exception: 7 ERROR: messages error here (var) and here\nHINT: hint messages here\nCONTEXT: PL/pgSQL function approval_list_fnc_status() line 23 at RAISE (SQL: update "table" set "field1" = value1, "field2" = value2 where "id" = 9528ac4b-e20f-4be4-b251-42f0e28df9a9)" SQLSTATE[P0001]: 引发异常: 7 错误: 消息错误在这里 (var) 和这里\n提示: 提示消息在这里\nCONTEXT: PL/pgSQL functionapproval_list_fnc_status() line 23 at RAISE (SQL: update "table" set "field1" = value1, "field2" = value2 其中 "id" = 9528ac4b-e20f-4be4-b251-42f0e28df9a9)"

how if i want to exclude the context from error?如果我想从错误中排除context怎么办?

The context information is always there, but all the attributes of an error message (detail, hint, context, ...) are separate, and it is up to your client code to use only the ones you are interested in.上下文信息始终存在,但错误消息的所有属性(详细信息、提示、上下文...)都是独立的,您的客户端代码只能使用您感兴趣的那些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM