proposal: use errcontext for custom exception too
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2011-11-24T17:30:03Z
Lists: pgsql-hackers
Attachments
- raise_context.diff (text/x-patch) patch
Hello There are small issue in PL/pgSQL and custom exceptions. Custom exception doesn't set a CONTEXT field. I propose change this behave for WARNING or EXCEPTION level. The goal is same behave for custom exception and builtin exception and it can help to identify a RAISE statement that is responsible to exception. ./pl_exec.c *** ./pl_exec.c.orig 2011-11-24 17:29:08.000000000 +0100 --- ./pl_exec.c 2011-11-24 18:23:51.513136718 +0100 *************** *** 2827,2833 **** /* * Throw the error (may or may not come back) */ ! estate->err_text = raise_skip_msg; /* suppress traceback of raise */ ereport(stmt->elog_level, (err_code ? errcode(err_code) : 0, --- 2827,2834 ---- /* * Throw the error (may or may not come back) */ ! if (stmt->elog_level < WARNING) ! estate->err_text = raise_skip_msg; /* suppress traceback of raise notice */ ereport(stmt->elog_level, (err_code ? errcode(err_code) : 0, Regards Pavel Stehule