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

From Pavel Stehule
Subject Re: proposal: use errcontext for custom exception too
Date
Msg-id CAFj8pRCRDwNrcW5EhKxnrkPSpGbWZtV-m7oDbFD_5hD02-Ohgw@mail.gmail.com
Whole thread Raw
In response to Re: proposal: use errcontext for custom exception too  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: proposal: use errcontext for custom exception too
List pgsql-hackers
2011/11/25 Robert Haas <robertmhaas@gmail.com>:
> On Thu, Nov 24, 2011 at 12:30 PM, Pavel Stehule <pavel.stehule@gmail.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
>


pgsql-hackers by date:

Previous
From: Pavan Deolasee
Date:
Subject: Re: Storing hot members of PGPROC out of the band
Next
From: Etsuro Fujita
Date:
Subject: Re: pgsql_fdw, FDW for PostgreSQL server