Re: Strange order of execution with rule

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Strange order of execution with rule
Дата
Msg-id 14397.1129844923@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Strange order of execution with rule  (han.holl@informationslogik.nl)
Ответы Re: Strange order of execution with rule  (han.holl@informationslogik.nl)
Re: Strange order of execution with rule  (han.holl@informationslogik.nl)
Список pgsql-general
han.holl@informationslogik.nl writes:
> I have something like this:
> CREATE or replace rule update_rule as on update
>     to aview
>     do instead (
>       select func_display(new, old);
>       select rubriek('reset', 0, '', 0);
>     );

> I tried all kinds of variations (one select with two functions, and two
> different update rules with a select each) but in _all_ cases the second
> function is executed before the first, or possibly at the same time (but I
> didn't think the backend is threaded).

Give us a test case to demonstrate this assertion.  It works as expected
AFAICT.

regression=# create function noti(text) returns int as $$
regression$# begin
regression$#   raise notice '%', $1;
regression$#   return 1;
regression$# end$$ language plpgsql;
CREATE FUNCTION
regression=# CREATE or replace rule update_rule as on update to zview
regression-# do instead (
regression(#   select noti('foo');
regression(#   select noti('bar');
regression(# );
CREATE RULE
regression=# update zview set q1 = q2;
NOTICE:  foo
NOTICE:  bar
 noti
------
    1
(1 row)


            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] 'a' == 'a '
Следующее
От: Chris Travers
Дата:
Сообщение: Re: Unique index with Null value in one field