From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | han(dot)holl(at)informationslogik(dot)nl |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Strange order of execution with rule |
Date: | 2005-10-20 21:48:43 |
Message-ID: | 14397.1129844923@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
han(dot)holl(at)informationslogik(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Travers | 2005-10-20 21:56:46 | Re: PSQL suggested enhancement |
Previous Message | Chris Travers | 2005-10-20 21:46:08 | Re: Unique index with Null value in one field |