Re: proposal: plpgsql - Assert statement

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: plpgsql - Assert statement
Date: 2014-11-19 17:34:38
Message-ID: CA+TgmoYCh+b85-yM943VkUdGuXnr-GVHtGeeWn1bCJN8wFKBfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 19, 2014 at 12:01 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, Nov 19, 2014 at 11:13 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> FWIW, I would vote against it also. I do not find this to be a natural
>>> extension of RAISE; it adds all sorts of semantic issues. (In particular,
>>> what is the evaluation order of the WHEN versus the other subexpressions
>>> of the RAISE?)
>
>> What I liked about this syntax was that we could eventually have:
>> RAISE ASSERT WHEN stuff;
>> ...and if assertions are disabled, we can skip evaluating the
>> condition. If you just write an IF .. THEN block you can't do that.
>
> Well, if that's what you want, let's just invent
>
> ASSERT condition
>
> and not tangle RAISE into it. The analogy to EXIT WHEN is a lot
> cleaner in this form: no order-of-evaluation issues, no questions
> of whether a sub-clause results in totally changing the meaning
> of the command. And if your argument is partially based on
> how much you have to type, doesn't this way dominate all others?

That doesn't bother me any.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-11-19 17:52:24 Re: Doing better at HINTing an appropriate column within errorMissingColumn()
Previous Message Peter Geoghegan 2014-11-19 17:33:58 Re: Doing better at HINTing an appropriate column within errorMissingColumn()