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