Re: Assertions in PL/PgSQL - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: Assertions in PL/PgSQL
Date
Msg-id CAFj8pRC0WUkfNHPDC7j0PJyjr2M8XrVYjGeT5qc6yzr29Er8MA@mail.gmail.com
Whole thread Raw
In response to Re: Assertions in PL/PgSQL  (Marko Tiikkaja <marko@joh.to>)
List pgsql-hackers



2013/9/23 Marko Tiikkaja <marko@joh.to>
On 9/23/13 10:50 AM, I wrote:
On 9/23/13 6:40 AM, Pavel Stehule wrote:
After days I am thinking so it can be a good solution

syntax - enhanced current RAISE

RAISE ASSERT WHEN boolean expression

RAISE ASSERT 'some message' WHEN expression

It looks like I'm losing this battle, but this syntax isn't too bad.

and we can have a GUC that controls asserts per database - possibly
overwritten by plpgsql option - similar to current plpgsql options

assert_level = [*ignore*, notice, warning, error]

This sounds like a decent enhancement.

Oh, it would be nice to have the option here to say "assertions can't be caught by exception handlers", but I don't know how that mechanism works so I'm not sure it's possible.  I'll have to look into that.

Personally, I don't think so it is too important, although it can be nice improvement. I don't see use cases where assert can be handled - and with conditional RAISE we can raise a custom exceptions simply.

Pavel
 


Regards,
Marko Tiikkaja

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Assertions in PL/PgSQL
Next
From: Pavel Stehule
Date:
Subject: Re: Assertions in PL/PgSQL