summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/rules.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-10-19 19:00:47 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-10-19 19:00:47 +0000
commitc1f91a38e20864c14650794a64d52f2d6c900e0f (patch)
tree49580b7e35a35799b5abfbeb0d3de03eab754744 /src/test/regress/sql/rules.sql
parent757b98fda828275443dfdf6e220001c9d497133a (diff)
downloadpostgresql-c1f91a38e20864c14650794a64d52f2d6c900e0f.tar.gz
Fix rewrite code so that rules are in fact executed in order by name,
rather than being reordered according to INSTEAD attribute for implementation convenience. Also, increase compiled-in recursion depth limit from 10 to 100 rewrite cycles. 10 seems pretty marginal for situations where multiple rules exist for the same query. There was a complaint about this recently, so I'm going to bump it up. (Perhaps we should make the limit a GUC parameter, but that's too close to being a new feature to do in beta.)
Diffstat (limited to 'src/test/regress/sql/rules.sql')
-rw-r--r--src/test/regress/sql/rules.sql11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/test/regress/sql/rules.sql b/src/test/regress/sql/rules.sql
index eb47245ce2..6ded00a445 100644
--- a/src/test/regress/sql/rules.sql
+++ b/src/test/regress/sql/rules.sql
@@ -100,6 +100,9 @@ create rule rtest_t6_ins as on insert to rtest_t6
--
-- Tables and rules for the rule fire order test
--
+-- As of PG 7.3, the rules should fire in order by name, regardless
+-- of INSTEAD attributes or creation order.
+--
create table rtest_order1 (a int4);
create table rtest_order2 (a int4, b int4, c text);
@@ -107,20 +110,20 @@ create sequence rtest_seq;
create rule rtest_order_r3 as on insert to rtest_order1 do instead
insert into rtest_order2 values (new.a, nextval('rtest_seq'),
- 'rule 3 - this should run 3rd or 4th');
+ 'rule 3 - this should run 3rd');
create rule rtest_order_r4 as on insert to rtest_order1
where a < 100 do instead
insert into rtest_order2 values (new.a, nextval('rtest_seq'),
- 'rule 4 - this should run 2nd');
+ 'rule 4 - this should run 4th');
create rule rtest_order_r2 as on insert to rtest_order1 do
insert into rtest_order2 values (new.a, nextval('rtest_seq'),
- 'rule 2 - this should run 1st');
+ 'rule 2 - this should run 2nd');
create rule rtest_order_r1 as on insert to rtest_order1 do instead
insert into rtest_order2 values (new.a, nextval('rtest_seq'),
- 'rule 1 - this should run 3rd or 4th');
+ 'rule 1 - this should run 1st');
--
-- Tables and rules for the instead nothing test