Re: PL/pgSQL, RAISE and error context

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL, RAISE and error context
Date: 2015-01-26 20:59:42
Message-ID: 54C6AABE.7040201@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 1/26/15 9:46 AM, Pavel Stehule wrote:
>
> The design I thought had been agreed on was to add some new option to
> plpgsql's RAISE command which would cause suppression of all CONTEXT lines
> not just the most closely nested one. You could argue about whether the
> behavior needs to be 100% backwards compatible or not --- if so, perhaps
> it could be a three-way option all, none, or one line, defaulting to the
> last for backwards compatibility.
>
>
> I see a problem what should be default behave. When I raise NOTICE, then I don't need (don't would) to see CONTEXT lines, When I raise EXCEPTION, then I usually would to see CONTEXT lines.

FWIW, that's the case I almost always run into: I turn on some debugging which means I know where the RAISE is coming from, but now I'm flooded with CONTEXT lines. You could do that with an option to RAISE, but that seems like a lot of extra coding work for little gain. Perhaps it'd be worth creating client_min_context and log_min_context GUCs...

Another option that I think would work well is that you only provide context for the first call within a "block" of code. For plpgsql that would be a function, but maybe it'd be better to just do this per-subtransaction.

I do agree that this needs to work across the board, not just for plpgsql.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2015-01-26 21:01:23 Re: New CF app deployment
Previous Message Peter Geoghegan 2015-01-26 20:54:04 Re: New CF app deployment