Re: Assertions in PL/PgSQL

Поиск
Список
Период
Сортировка
От Marko Tiikkaja
Тема Re: Assertions in PL/PgSQL
Дата
Msg-id 5234D6AB.8030206@joh.to
обсуждение исходный текст
Ответ на Re: Assertions in PL/PgSQL  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Assertions in PL/PgSQL  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On 2013-09-14 23:05, Pavel Stehule wrote:
> 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, ...

I don't see why e.g. PRAGMA AssertNotEmpty(foo);  would be better than 
ASSERT NotEmpty(foo);  and the NotNull version is even sillier 
considering the expression is arbitrary SQL, and we'd have to do all 
kinds of different versions or people would be disappointed (AssertNull, 
AssertNotNull, AssertExists, AssertNotExists, etc.).

I see what you're trying to do, but I don't think crippling new features 
just because we might do something similar at some point is a good idea.  I'm guessing this is what happened with the
row_countsyntax, which 
 
made the feature an absolute nightmare to use.

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

That I think is worth looking into.


Regards,
Marko Tiikkaja



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [PATCH] bitmap indexes
Следующее
От: Andres Freund
Дата:
Сообщение: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE