Re: PL/pgSQL, RAISE and error context

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL, RAISE and error context
Date: 2013-08-21 12:43:29
Message-ID: CAFj8pRDCQt9y_TJJhDtXouWbvgK=j6vYgLm7u9eqx==ma1cw-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/8/21 Marko Tiikkaja <marko(at)joh(dot)to>

> Hi,
>
> By default, PL/pgSQL does not print the error context of a RAISE
> statement, for example:
>
> =# create function foof() returns void as $$ begin raise exception 'foo';
> end $$ language plpgsql;
> CREATE FUNCTION
>
> =# create function bar() returns void as $$ begin perform foof(); end $$
> language plpgsql;
> CREATE FUNCTION
>
> =# select bar();
> ERROR: foo
> CONTEXT: SQL statement "SELECT foof()"
> PL/pgSQL function "bar" line 1 at PERFORM
>
>
> I find this extremely surprising, since if you raise the same exception
> (or a DEBUG/NOTICE message) in multiple places, the error context is
> missing valuable information. With a trivial change the last error could
> be:
>
> =# select bar();
> ERROR: foo
> CONTEXT: PL/pgSQL function "foof" line 1 RAISE
> SQL statement "SELECT foof()"
> PL/pgSQL function "bar" line 1 at PERFORM
>
> which I find a lot better.
>

+1

Pavel

>
> Thoughts?
>
>
> Regards,
> Marko Tiikkaja
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-hackers<http://www.postgresql.org/mailpref/pgsql-hackers>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2013-08-21 13:00:00 Re: PL/pgSQL, RAISE and error context
Previous Message Stephen Frost 2013-08-21 12:40:24 Re: Back-patch change in hashed DISTINCT estimation?