Re: Assertions in PL/PgSQL

Поиск
Список
Период
Сортировка
Искать
От
Pavel Stehule
Тема
Re: Assertions in PL/PgSQL
Дата
Msg-id
CAFj8pRDrPK-gVk-hQCK7wqTYHk-7QUpjbtJFDdOVQ0JjBiA9CA@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Peter Eisentraut <peter_e@gmx.net>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Peter Eisentraut <peter_e@gmx.net>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Jaime Casanova <jaime@2ndquadrant.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Jaime Casanova <jaime@2ndquadrant.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Robert Haas <robertmhaas@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Robert Haas <robertmhaas@gmail.com>
Re: Assertions in PL/PgSQL Hannu Krosing <hannu@2ndQuadrant.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Jim Nasby <jim@nasby.net>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Jim Nasby <jim@nasby.net>
Re: Assertions in PL/PgSQL Jaime Casanova <jaime@2ndquadrant.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Amit Khandekar <amit.khandekar@enterprisedb.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Jaime Casanova <jaime@2ndquadrant.com>
Re: Assertions in PL/PgSQL Jaime Casanova <jaime@2ndquadrant.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Andres Freund <andres@2ndquadrant.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Amit Khandekar <amit.khandekar@enterprisedb.com>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Marko Tiikkaja <marko@joh.to>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Amit Khandekar <amit.khandekar@enterprisedb.com>
Re: Assertions in PL/PgSQL Robert Haas <robertmhaas@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Peter Eisentraut <peter_e@gmx.net>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Tom Lane <tgl@sss.pgh.pa.us>
Re: Assertions in PL/PgSQL Robert Haas <robertmhaas@gmail.com>
Re: Assertions in PL/PgSQL Peter Eisentraut <peter_e@gmx.net>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Robert Haas <robertmhaas@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Pavel Stehule <pavel.stehule@gmail.com>
Re: Assertions in PL/PgSQL Robert Haas <robertmhaas@gmail.com>
Re: Assertions in PL/PgSQL Jaime Casanova <jaime@2ndquadrant.com>



2013/9/20 Alvaro Herrera <alvherre@2ndquadrant.com>
Pavel Stehule escribió:

> PL/pgSQL had a ADA completeness, uniformity and beauty newer. But it is not
> too bad, and one new specialized statement doesn't kill us. A proposed
> functionality is often used and we have not tools (macros) how to implement
> it simply.
>
> we support a conditions for few statement - so enhancing RAISE statement is
> possible

Extending RAISE is one option.  Another option is to decorate BEGIN and
END with an assertion option; and the assertion would be checked when
the block is entered (in BEGIN) or finished (in END).

BEGIN ASSERT (a = 1) WITH (name = a_is_one)
    a := a + 1;
END;


BEGIN ASSERT (a > 0)
    a := a + 1;
END ASSERT (a = 2) WITH (name = a_is_two);

This would play nice with loops too, where the assertion is checked on
every iteration.  And you can have empty blocks if you want the
assertion to be standalone in the middle of some block.

it can works, but it looks too strange

-1

Pavel
 

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
От: Andres Freund
Дата:
FAQ