Search Postgresql Archives

Re: Strange order of execution with rule

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



han.holl@xxxxxxxxxxxxxxxxxxxx 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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux