Re: Assertions in PL/PgSQL

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assertions in PL/PgSQL
Date: 2013-09-14 21:05:23
Message-ID: CAFj8pRBy=wjkGL2bmntQVE2uYX4A5EQBGJRyKytwbtuTPaC-qA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

> On 2013-09-14 22:40, I wrote:
>
>> Someone may prove me wrong here, but to me it looks like this would only
>> prevent ASSERT from being used as the name of a PL/PgSQL variable.
>>
>
> The comment at the beginning of pl_scanner.c seems to suggest same.
>

yes, there are no too much possibilities, how to do it.

Effective implementation needs a special PLpgSQL statement - but I am 100%
happy with proposed syntax. We introduce a new special keyword just for one
simple construct.

A some languages has a generic PRAGMA keyword. So I would be much more
happy with something like

PRAGMA Assert(found);

It is much more close to ADA, and it allows a reuse of new keyword for any
other usage in future (your proposal is too simply, without possibility
open new doors in future). And we can define a some standard predefined
asserts too - like Assert, AssertNotNull, AssertNotEmpty, ...

other issue - A asserts macros has one or two parameters usually. You
should to support two params assert (with message).

>
> Regards,
> Marko Tiikkaja
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-09-14 21:21:05 Re: [RFC] Extend namespace of valid guc names
Previous Message Andres Freund 2013-09-14 20:49:13 logical changeset generation v6