On 09/05/2014 05:21 PM, Pavel Stehule wrote: > > *shrug* Doing it in SQL would probably break more stuff. I'm trying to > contain the damage. And arguably, this is mostly only useful in PL/PgSQL.
I've wanted assertions in SQL enough that I often write trivial wrappers around `raise` in PL/PgSQL for use in `CASE` statements etc.
In this moment we have no agreement on syntax, but there was not defined a requirements for aggregations. I looked on assertions in some languages and implementation and design of assertions is really varied.
I though about it, and "Assertions" is not plpgsql only issue. It must be supported by core, and by other PL.
There are two usual requests for Assertions:
a) Isn't possible handle a assertion exception anywhere .. it enforce ROLLBACK in 100%
b) Assertions should be disabled globally .. I am not sure, it it is a good idea, but I can understand so some tests based on queries to data can be performance issue.
Important question is a relation assertations and exceptions. Is it only shortcut for exception or some different?