Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2013 The PostgreSQL Global Development Group