Re: LOCK TABLE is not allowed in a non-volatile function

From: Eliot Gable <egable+pgsql-general(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: LOCK TABLE is not allowed in a non-volatile function
Date: 2012-04-20 20:38:16
Message-ID: CAD-6L_U3MYkVjKKpXv8-sPw-B8aZHBnP1mwn1AFYxMyaOdZDEA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 18, 2012 at 3:47 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Eliot Gable <egable+pgsql-general(at)gmail(dot)com> writes:
> > On Wed, Apr 18, 2012 at 1:01 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> However, there still might be an issue, because the CONTEXT trace that
> >> you showed certainly seemed to point where you thought it did.
>
> > After re-reading the LOCK modes and realizing that ACCESS SHARE is not
> the
> > same as SHARE, I believe you are correct; the only issue seems to be in
> the
> > CONTEXT trace failing to point out that the error occurred three function
> > calls deeper than what was reported. It seems it reported it in the first
> > function where the EXCEPTION handling was set up.
>
> Oh! Yes, that's to be expected, because so far as Postgres is concerned
> it's logging the location of the RAISE WARNING command. You've only
> told it to print the SQLERRM string, and nothing else:
>
> RAISE WARNING 'An error occurred while trying to rotate the live user
> activity records; code %: %', SQLSTATE, SQLERRM;
>
> As of 9.2 there is a way to get the context string for the original
> error (GET STACKED DIAGNOSTICS) which you could then include in the
> RAISE message. That hasn't made it to any released versions
> unfortunately.
>
> regards, tom lane
>

Is there a way to print out context in 9.0.1 when doing exception handling
and raising a message? Right now, all I get is my error code, description
of the error, and no idea what the specific statement is that is generating
the error in the first place. Am I missing something, or is this just not
possible in 9.0.1?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-04-20 20:41:02 Re: Explain verbose query with CTE
Previous Message Bartosz Dmytrak 2012-04-20 20:17:00 Explain verbose query with CTE