Re: proposal: plpgsql - Assert statement

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: proposal: plpgsql - Assert statement
Дата
Msg-id CA+TgmoZD4YwePX6t94AeybMei3EuGdVSjLmhMUOT8a6onz3URA@mail.gmail.com
обсуждение исходный текст
Ответ на proposal: plpgsql - Assert statement  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal: plpgsql - Assert statement  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
On Fri, Sep 5, 2014 at 2:16 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> Assert is usually implemented as custom functions and used via PERFORM
> statement now
>
> -- usual current solution
> PERFORM Assert(some expression)
>
> I would to implement Assert as plpgsql internal statement due bigger
> possibilities to design syntax and internal implementation now and in
> future. More - as plpgsql statement should be compatible with any current
> code - because there should not be collision between SQL and PLpgSQL space.
> So this design doesn't break any current code.
>
> I propose following syntax with following ecosystem:
>
> ASSERT [ NOTICE, WARNING, >>EXCEPTION<< ]
>               [ string expression or literal - explicit message ]
>               [ USING clause - same as RAISE stmt (possible in future ) ]
>   ( ROW_COUNT ( = | <> ) ( 1 | 0 ) |
>   ( QUERY some query should not be empty ) |
>   ( CHECK some expression should be true )
>   ( IS NOT NULL expression should not be null )
>
> Every variant (ROW_COUNT, QUERY, CHECK, IS NOT NULL) has own default message

That's probably not the ugliest syntax I've *ever* seen, but it's
definitely the ugliest syntax I've seen today.

I previously proposed RAISE ASSERT ... WHERE, which seems like a nice
variant of what we've already got, but perhaps this whole discussion
merely illustrates that it's hard to get more than 1 vote for any
proposal in this area.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: ALTER TABLESPACE MOVE command tag tweak
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: ALTER TABLESPACE MOVE command tag tweak