Skip to content

Commit

Permalink
Remove tests depending on rules with SELECT ON for tables
Browse files Browse the repository at this point in the history
Upstream PostgreSQL has removed support for SELECT ON rules for all
relation types except views in b23cd18, impacting v16~.  The regression
tests of pg_hint_plan had some tests that depended on such rules to make
sure that hints are working correctly when a table is rewritten as a
view, introduced in 1bbcfa2.

Now that PostgreSQL does not support this scenario, there is no need to
worry about these in pg_hint_plan either, so let's remove all that.
This counted for roughly 30% of the noise still in regression.diffs when
running the regression tests.

Per pull request #129.
  • Loading branch information
michaelpq committed Apr 20, 2023
1 parent f03bf56 commit da28ef7
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 311 deletions.
59 changes: 0 additions & 59 deletions expected/ut-J.out
Original file line number Diff line number Diff line change
Expand Up @@ -3662,65 +3662,6 @@ error hint:
Index Cond: (c1 = v1t1.c1)
(4 rows)

-- No. J-2-3-6
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
------------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r4t1_1
(5 rows)

/*+HashJoin(r4t1 r4t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
INFO: pg_hint_plan: hint syntax error at or near "HashJoin(r4t1 r4t1)"
DETAIL: Relation name "r4t1" is ambiguous.
LOG: pg_hint_plan:
used hint:
not used hint:
duplication hint:
error hint:
HashJoin(r4t1 r4t1)

QUERY PLAN
------------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r4t1_1
(5 rows)

-- No. J-2-3-7
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
----------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r5t1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r5t1
(5 rows)

/*+NestLoop(r4t1 r5t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
used hint:
NestLoop(r4t1 r5t1)
not used hint:
duplication hint:
error hint:

QUERY PLAN
-----------------------------------------
Nested Loop
-> Seq Scan on t1 r4t1
-> Index Scan using t1_i1 on t1 r5t1
Index Cond: (c1 = r4t1.c1)
(4 rows)

----
---- No. J-2-4 VALUES clause
----
Expand Down
60 changes: 0 additions & 60 deletions expected/ut-L.out
Original file line number Diff line number Diff line change
Expand Up @@ -3488,66 +3488,6 @@ error hint:
-> Seq Scan on t1 v1t1_
(5 rows)

-- No. L-2-3-6
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
------------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r4t1_1
(5 rows)

/*+Leading(r4t1 r4t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
INFO: pg_hint_plan: hint syntax error at or near "Leading(r4t1 r4t1)"
DETAIL: Relation name "r4t1" is ambiguous.
LOG: pg_hint_plan:
used hint:
not used hint:
duplication hint:
error hint:
Leading(r4t1 r4t1)

QUERY PLAN
------------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r4t1_1
(5 rows)

-- No. L-2-3-7
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
----------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r5t1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r5t1
(5 rows)

/*+Leading(r4t1 r5t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
used hint:
Leading(r4t1 r5t1)
not used hint:
duplication hint:
error hint:

QUERY PLAN
----------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r5t1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r5t1
(5 rows)

----
---- No. L-2-4 VALUES clause
----
Expand Down
71 changes: 0 additions & 71 deletions expected/ut-R.out
Original file line number Diff line number Diff line change
Expand Up @@ -4112,77 +4112,6 @@ error hint:
-> Index Scan using t1_i1 on t1 v1t1_ (cost=xxx..xxx rows=1 width=xxx)
Index Cond: (c1 = v1t1.c1)

-- No. R-2-3-6
\o results/ut-R.tmpout
/*+RowsHashJoin(r4t1 r4t1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
INFO: pg_hint_plan: hint syntax error at or near "RowsHashJoin(r4t1 r4t1)"
DETAIL: Unrecognized hint keyword "RowsHashJoin".
\o
\! sql/maskout.sh results/ut-R.tmpout
QUERY PLAN
----------------
Hash Join (cost=xxx..xxx rows=1000 width=xxx)
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1 (cost=xxx..xxx rows=1000 width=xxx)
-> Hash (cost=xxx..xxx rows=1000 width=xxx)
-> Seq Scan on t1 r4t1_1 (cost=xxx..xxx rows=1000 width=xxx)

\o results/ut-R.tmpout
/*+RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
INFO: pg_hint_plan: hint syntax error at or near "RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)"
DETAIL: Unrecognized hint keyword "RowsHashJoin".
\o
\! sql/maskout.sh results/ut-R.tmpout
QUERY PLAN
----------------
Hash Join (cost=xxx..xxx rows=1000 width=xxx)
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1 (cost=xxx..xxx rows=1000 width=xxx)
-> Hash (cost=xxx..xxx rows=1000 width=xxx)
-> Seq Scan on t1 r4t1_1 (cost=xxx..xxx rows=1000 width=xxx)

-- No. R-2-3-7
\o results/ut-R.tmpout
/*+NestLoop(r4t1 r5t1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
used hint:
NestLoop(r4t1 r5t1)
not used hint:
duplication hint:
error hint:

\o
\! sql/maskout.sh results/ut-R.tmpout
QUERY PLAN
----------------
Nested Loop (cost=xxx..xxx rows=1000 width=xxx)
-> Seq Scan on t1 r4t1 (cost=xxx..xxx rows=1000 width=xxx)
-> Index Scan using t1_i1 on t1 r5t1 (cost=xxx..xxx rows=1 width=xxx)
Index Cond: (c1 = r4t1.c1)

\o results/ut-R.tmpout
/*+NestLoop(r4t1 r5t1)Rows(r4t1 r5t1 #1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
used hint:
NestLoop(r4t1 r5t1)
Rows(r4t1 r5t1 #1)
not used hint:
duplication hint:
error hint:

\o
\! sql/maskout.sh results/ut-R.tmpout
QUERY PLAN
----------------
Nested Loop (cost=xxx..xxx rows=1 width=xxx)
-> Seq Scan on t1 r4t1 (cost=xxx..xxx rows=1000 width=xxx)
-> Index Scan using t1_i1 on t1 r5t1 (cost=xxx..xxx rows=1 width=xxx)
Index Cond: (c1 = r4t1.c1)

----
---- No. R-2-4 VALUES clause
----
Expand Down
61 changes: 0 additions & 61 deletions expected/ut-S.out
Original file line number Diff line number Diff line change
Expand Up @@ -2916,67 +2916,6 @@ error hint:
Index Cond: (c1 = v1t1.c1)
(6 rows)

-- No. S-2-3-6
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
------------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r4t1_1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r4t1_1
(5 rows)

/*+BitmapScan(r4t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
used hint:
BitmapScan(r4t1)
not used hint:
duplication hint:
error hint:

QUERY PLAN
------------------------------------------
Nested Loop
-> Index Scan using t1_i1 on t1 r4t1
-> Bitmap Heap Scan on t1 r4t1_1
Recheck Cond: (c1 = r4t1.c1)
-> Bitmap Index Scan on t1_i1
Index Cond: (c1 = r4t1.c1)
(6 rows)

-- No. S-2-3-7
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
QUERY PLAN
----------------------------------
Hash Join
Hash Cond: (r4t1.c1 = r5t1.c1)
-> Seq Scan on t1 r4t1
-> Hash
-> Seq Scan on t1 r5t1
(5 rows)

/*+SeqScan(r4t1)BitmapScan(r5t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
LOG: pg_hint_plan:
used hint:
SeqScan(r4t1)
BitmapScan(r5t1)
not used hint:
duplication hint:
error hint:

QUERY PLAN
------------------------------------------
Nested Loop
-> Seq Scan on t1 r4t1
-> Bitmap Heap Scan on t1 r5t1
Recheck Cond: (c1 = r4t1.c1)
-> Bitmap Index Scan on t1_i1
Index Cond: (c1 = r4t1.c1)
(6 rows)

----
---- No. S-2-4 VALUES clause
----
Expand Down
2 changes: 0 additions & 2 deletions expected/ut-init.out
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,3 @@ SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1
SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)';
SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)';
);
CREATE RULE "_RETURN" AS ON SELECT TO s1.r4 DO INSTEAD SELECT r4t1.c1, r4t1.c2, r4t1.c3, r4t1.c4 FROM s1.t1 r4t1;
CREATE RULE "_RETURN" AS ON SELECT TO s1.r5 DO INSTEAD SELECT r5t1.c1, r5t1.c2, r5t1.c3, r5t1.c4 FROM s1.t1 r5t1;
10 changes: 0 additions & 10 deletions sql/ut-J.sql
Original file line number Diff line number Diff line change
Expand Up @@ -636,16 +636,6 @@ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
/*+NestLoop(v1t1 v1t1_)*/
EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;

-- No. J-2-3-6
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
/*+HashJoin(r4t1 r4t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;

-- No. J-2-3-7
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
/*+NestLoop(r4t1 r5t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;

----
---- No. J-2-4 VALUES clause
----
Expand Down
10 changes: 0 additions & 10 deletions sql/ut-L.sql
Original file line number Diff line number Diff line change
Expand Up @@ -524,16 +524,6 @@ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
/*+Leading(v1t1 v1t1_)*/
EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;

-- No. L-2-3-6
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
/*+Leading(r4t1 r4t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;

-- No. L-2-3-7
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
/*+Leading(r4t1 r5t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;

----
---- No. L-2-4 VALUES clause
----
Expand Down
26 changes: 0 additions & 26 deletions sql/ut-R.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1120,32 +1120,6 @@ EXPLAIN SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
\o
\! sql/maskout.sh results/ut-R.tmpout

-- No. R-2-3-6
\o results/ut-R.tmpout
/*+RowsHashJoin(r4t1 r4t1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
\o
\! sql/maskout.sh results/ut-R.tmpout

\o results/ut-R.tmpout
/*+RowsHashJoin(r4t1 r4t1)Rows(r4t1 r4t1 #1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
\o
\! sql/maskout.sh results/ut-R.tmpout

-- No. R-2-3-7
\o results/ut-R.tmpout
/*+NestLoop(r4t1 r5t1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
\o
\! sql/maskout.sh results/ut-R.tmpout

\o results/ut-R.tmpout
/*+NestLoop(r4t1 r5t1)Rows(r4t1 r5t1 #1)*/
EXPLAIN SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
\o
\! sql/maskout.sh results/ut-R.tmpout

----
---- No. R-2-4 VALUES clause
----
Expand Down
10 changes: 0 additions & 10 deletions sql/ut-S.sql
Original file line number Diff line number Diff line change
Expand Up @@ -469,16 +469,6 @@ EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;
/*+SeqScan(v1t1)BitmapScan(v1t1_)*/
EXPLAIN (COSTS false) SELECT * FROM s1.v1 v1, s1.v1_ v2 WHERE v1.c1 = v2.c1;

-- No. S-2-3-6
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;
/*+BitmapScan(r4t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r4 t2 WHERE t1.c1 = t2.c1;

-- No. S-2-3-7
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;
/*+SeqScan(r4t1)BitmapScan(r5t1)*/
EXPLAIN (COSTS false) SELECT * FROM s1.r4 t1, s1.r5 t2 WHERE t1.c1 = t2.c1;

----
---- No. S-2-4 VALUES clause
----
Expand Down
2 changes: 0 additions & 2 deletions sql/ut-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,3 @@ SELECT max(b1t1.c1) FROM s1.t1 b1t1, s1.t2 b1t2, s1.t3 b1t3, s1.t4 b1t4 WHERE b1
SELECT max(b2t1.c1) FROM s1.t1 b2t1, s1.t2 b2t2, s1.t3 b2t3, s1.t4 b2t4 WHERE b2t1.ctid = '(1,1)' AND b2t1.c1 = b2t2.c1 AND b2t2.ctid = '(1,1)' AND b2t1.c1 = b2t3.c1 AND b2t3.ctid = '(1,1)' AND b2t1.c1 = b2t4.c1 AND b2t4.ctid = '(1,1)';
SELECT max(b3t1.c1) FROM s1.t1 b3t1, s1.t2 b3t2, s1.t3 b3t3, s1.t4 b3t4 WHERE b3t1.ctid = '(1,1)' AND b3t1.c1 = b3t2.c1 AND b3t2.ctid = '(1,1)' AND b3t1.c1 = b3t3.c1 AND b3t3.ctid = '(1,1)' AND b3t1.c1 = b3t4.c1 AND b3t4.ctid = '(1,1)';
);
CREATE RULE "_RETURN" AS ON SELECT TO s1.r4 DO INSTEAD SELECT r4t1.c1, r4t1.c2, r4t1.c3, r4t1.c4 FROM s1.t1 r4t1;
CREATE RULE "_RETURN" AS ON SELECT TO s1.r5 DO INSTEAD SELECT r5t1.c1, r5t1.c2, r5t1.c3, r5t1.c4 FROM s1.t1 r5t1;

0 comments on commit da28ef7

Please sign in to comment.