Re: Assertions in PL/PgSQL

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Assertions in PL/PgSQL
Дата
Msg-id CAFj8pRBy=wjkGL2bmntQVE2uYX4A5EQBGJRyKytwbtuTPaC-qA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Assertions in PL/PgSQL  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: Assertions in PL/PgSQL  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers



2013/9/14 Marko Tiikkaja <marko@joh.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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: logical changeset generation v6
Следующее
От: Andres Freund
Дата:
Сообщение: Re: [RFC] Extend namespace of valid guc names