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

From Pavel Stehule
Subject Re: proposal: plpgsql - Assert statement
Date
Msg-id CAFj8pRCCJq5jn4TtWvn01FMs6fzzvuMsxxHO4bXf-eqr-vcrVA@mail.gmail.com
Whole thread Raw
In response to Re: proposal: plpgsql - Assert statement  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: proposal: plpgsql - Assert statement  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers


2014-09-17 21:00 GMT+02:00 Peter Eisentraut <peter_e@gmx.net>:
On 9/14/14 2:49 PM, Jan Wieck wrote:
> I don't think it is even a good idea to implement assertions that can
> query arbitrary data.

In a normal programming language, an assertion is usually a static fault
in your program.  If the assertion ever fails, you fix your program and
then it hopefully never happens again.

Assertion that query the state of the database or result row counts are
pushing that concept quite a bit.  Those are not assertions, those are
just plain old error handling.


What is difference between content of variable or content of database? You can test any prerequisite, but when this prerequisite is not solved, than exception is very very hard without possible handling.

Pavel 
 

pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: proposal: plpgsql - Assert statement
Next
From: Szymon Guz
Date:
Subject: Re: printing table in asciidoc with psql