Re: proposal: plpgsql - Assert statement - Mailing list pgsql-hackers

From Jim Nasby
Subject Re: proposal: plpgsql - Assert statement
Date
Msg-id 54C6B2DE.3010308@BlueTreble.com
Whole thread Raw
In response to Re: proposal: plpgsql - Assert statement  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal: plpgsql - Assert statement
Re: proposal: plpgsql - Assert statement
List pgsql-hackers
On 1/22/15 2:01 PM, Pavel Stehule wrote:
>
>         * I would to simplify a behave of evaluating of message expression - probably I disallow NULL there.
>
>
>     Well, the only thing I could see you doing there is throwing a different error if the hint is null. I don't see
thatas an improvement. I'd just leave it as-is.
 
>
>
> I enabled a NULL - but enforced a WARNING before.

I don't see the separate warning as being helpful. I'd just do something like

+                 (err_hint != NULL) ? errhint("%s", err_hint) : errhint("Message attached to failed assertion is
null")));
 

There should also be a test case for a NULL message.

>         * GUC enable_asserts will be supported
>
>
>     That would be good. Would that allow for enabling/disabling on a per-function basis too?
>
>
> sure - there is only question if we develop a #option enable|disable_asserts. I have no string idea.

The option would be nice, but I don't think it's strictly necessary. The big thing is being able to control this on a
per-functionbasis (which I think you can do with ALTER FUNCTION SET?)
 
-- 
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com



pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: New CF app deployment
Next
From: Andres Freund
Date:
Subject: Re: New CF app deployment