proposal: use errcontext for custom exception too - Mailing list pgsql-hackers

From Pavel Stehule
Subject proposal: use errcontext for custom exception too
Date
Msg-id CAFj8pRCxveO8OCU3Bmny327tN9P8JyH81-mB-9Dnx3TvFJZM-g@mail.gmail.com
Whole thread Raw
Responses Re: proposal: use errcontext for custom exception too
List 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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Time bug with small years
Next
From: Mikko Tiihonen
Date:
Subject: Re: [JDBC] Optimize postgres protocol for fixed size arrays