Re: proposal: use errcontext for custom exception too

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: use errcontext for custom exception too
Date: 2011-11-25 06:14:56
Message-ID: CAFj8pRCRDwNrcW5EhKxnrkPSpGbWZtV-m7oDbFD_5hD02-Ohgw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2011/11/25 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Thu, Nov 24, 2011 at 12:30 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 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.
>
> That seems completely arbitrary.  I think we discussed before
> providing an option to allow the user to control this, which seems
> better than implementing some hardcoded rule that may or may not be
> what a given user wants.

A some option via #option or GUC has sense for lower levels like
NOTICE or WARNING. For exception level CONTEXT should be filled every
time - usually you have a stack of CONTEXT calls, because exception
must not be on direct call, but the last CONTEXT (where exception was
created missing). It is confusing. When a advanced developer see a
exception without CONTEXT, then he know so exception is related to
RAISE statement, but still is not simple find a statement, that raised
exception - the line number is missing.

Compromise solution can be GUC where CONTEXT is default for ERROR level

like plpgsql.log_context_error_level = ERROR

A new option on RAISE STATEMENT is not well, usually you want to same
behave on complete application.

Regards

Pavel

>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2011-11-25 08:27:53 Re: pgsql_fdw, FDW for PostgreSQL server
Previous Message Pavan Deolasee 2011-11-25 04:54:23 Re: Storing hot members of PGPROC out of the band