Re: proposal: plpgsql - Assert statement

From: Marko Tiikkaja <marko(at)joh(dot)to>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jan Wieck <jan(at)wi3ck(dot)info>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: plpgsql - Assert statement
Date: 2014-09-06 17:26:26
Message-ID: 540B43C2.1020808@joh.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-09-06 7:27 AM, Pavel Stehule wrote:
> 2014-09-05 14:35 GMT+02:00 Jan Wieck <jan(at)wi3ck(dot)info>:
>> Adding a WHEN clause to RAISE would have the benefit of not needing any
>> new keywords at all.
>>
>> RAISE EXCEPTION 'format' [, expr ...] WHEN row_count <> 1;
>>
>
> It was one my older proposal.
>
> Can we find a agreement there?

I find:

1) The syntax less readable than IF row_count <> 1 THEN RAISE
EXCEPTION ..; END IF;
2) It needless to require the user to specify an error message for
every assertion.
3) Allowing these to be disabled would be weird (though I might be
the only one who wants that feature at this point).
4) It would also be weird to display the parameters passed to the
WHEN clause like I suggested here:
http://www.postgresql.org/message-id/54096BA4.5030600@joh.to . I think
that's a crucial part of the feature.

So at least the vote isn't unanimous: -1 from me.

.marko

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oskari Saarenmaa 2014-09-06 17:34:00 Re: PL/pgSQL 1.2
Previous Message Petr Jelinek 2014-09-06 17:16:37 Re: proposal: plpgsql - Assert statement