Re: Assertions in PL/PgSQL

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Amit Khandekar <amit(dot)khandekar(at)enterprisedb(dot)com>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assertions in PL/PgSQL
Date: 2013-09-23 09:16:13
Message-ID: CAFj8pRAJiY6M6S_jFzTLMNN6BUS+fuQEtwDtv3D8R6qZhk9EGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/9/23 Marko Tiikkaja <marko(at)joh(dot)to>

> On 9/23/13 11:12 AM, I wrote:
>
>> On 9/23/13 11:01 AM, Amit Khandekar wrote:
>>
>>> The assert levels sound a bit like a user might be confused by these
>>> levels
>>> being present at both places: In the RAISE syntax itself, and the assert
>>> GUC level. But I like the syntax. How about keeping the ASSERT keyword
>>> optional ? When we have WHEN, we anyway mean that we ware asserting that
>>> this condition must be true. So something like this :
>>>
>>> RAISE [ level ] 'format' [, expression [, ... ]] [ USING option =
>>> expression [, ... ] ];
>>> RAISE [ level ] condition_name [ USING option = expression [, ... ] ];
>>> RAISE [ level ] SQLSTATE 'sqlstate' [ USING option = expression [, ... ]
>>> ];
>>> RAISE [ level ] USING option = expression [, ... ];
>>> *RAISE [ ASSERT ] WHEN bool_expression;*
>>> RAISE ;
>>>
>>
>> I'd expect RAISE .. WHEN ..; to be the same as:
>>
>> IF .. THEN
>> RAISE;
>> END IF;
>>
>
> Should've probably proofread that one. I meant:
>
> RAISE WHEN true;
>
> would be equivalent to
>
> IF true THEN
> RAISE;
> END IF;
>

we use a RAISE only keyword statement for resignaling, so it can be really
confusing

Pavel

>
>
>
> Regards,
> Marko Tiikkaja
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2013-09-23 09:48:16 Re: Assertions in PL/PgSQL
Previous Message Marko Tiikkaja 2013-09-23 09:14:23 Re: Assertions in PL/PgSQL