Re: Assertions in PL/PgSQL

Поиск
Список
Период
Сортировка
От Amit Khandekar
Тема Re: Assertions in PL/PgSQL
Дата
Msg-id CACoZds0KJ_J-AWDhDxmJf0o24teSoLYEB8vn0FVcCQL9df-Cjg@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



On 16 September 2013 03:43, Marko Tiikkaja <marko@joh.to> wrote:
On 2013-09-15 23:23, Jaime Casanova wrote:
If using ASSERT as keyword is not acceptable, not that i agree but in case.
What about using RAISE EXCEPTION WHEN (condition)

I was going to suggest the same idea: Extend RAISE syntax without introducing new keywords. Something like:
RAISE assert_exception WHEN <assert_condition>
... where assert_exception is a new exception label which maps to a new internal sqlstate.
 
I think it would be extremely surprising if a command like that got optimized away based on a GUC, so I don't think that would be a good idea.

In pl_gram.y, in the rule stmt_raise, determine that this RAISE is for ASSERT, and then return NULL if plpgsql_curr_compile->enable_assertions is false. Isn't this possible ?
 



Regards,
Marko Tiikkaja


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: Daniel Farina
Дата:
Сообщение: Re: pg_stat_statements: calls under-estimation propagation
Следующее
От: Sameer Thakur
Дата:
Сообщение: Re: Patch for fail-back without fresh backup