proposal: use errcontext for custom exception too

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: use errcontext for custom exception too
Date: 2011-11-24 17:30:03
Message-ID: CAFj8pRCxveO8OCU3Bmny327tN9P8JyH81-mB-9Dnx3TvFJZM-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
raise_context.diff text/x-patch 7.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikko Tiihonen 2011-11-24 18:54:43 Re: [JDBC] Optimize postgres protocol for fixed size arrays
Previous Message Tom Lane 2011-11-24 17:00:54 Re: Time bug with small years