Commit 1d278425 authored by Tom Lane's avatar Tom Lane

Second try at stabilizing query plans in rowsecurity regression test.

This reverts commit 5cdf25e1,
which was almost immediately proven insufficient by the buildfarm.

On second thought, the tables involved are not large enough that
autovacuum or autoanalyze would notice them; what seems far more
likely to be the culprit is the database-wide "vacuum analyze"
in the concurrent gist test.  That thing has given us one headache
too many, so get rid of it in favor of targeted vacuuming of that
test's own tables only.
parent 1676e438
...@@ -16,7 +16,7 @@ delete from gist_point_tbl where id % 2 = 1; ...@@ -16,7 +16,7 @@ delete from gist_point_tbl where id % 2 = 1;
-- attempt to delete pages even when they become empty, but if it did, this -- attempt to delete pages even when they become empty, but if it did, this
-- would exercise it) -- would exercise it)
delete from gist_point_tbl where id < 10000; delete from gist_point_tbl where id < 10000;
vacuum gist_point_tbl; vacuum analyze gist_point_tbl;
-- --
-- Test Index-only plans on GiST indexes -- Test Index-only plans on GiST indexes
-- --
...@@ -26,7 +26,7 @@ select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)), ...@@ -26,7 +26,7 @@ select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)),
point(0.05*i, 0.05*i), point(0.05*i, 0.05*i),
circle(point(0.05*i, 0.05*i), 1.0) circle(point(0.05*i, 0.05*i), 1.0)
from generate_series(0,10000) as i; from generate_series(0,10000) as i;
vacuum analyze; vacuum analyze gist_tbl;
set enable_seqscan=off; set enable_seqscan=off;
set enable_bitmapscan=off; set enable_bitmapscan=off;
set enable_indexonlyscan=on; set enable_indexonlyscan=on;
......
...@@ -68,8 +68,6 @@ INSERT INTO document VALUES ...@@ -68,8 +68,6 @@ INSERT INTO document VALUES
( 6, 22, 1, 'rls_regress_user2', 'great science fiction'), ( 6, 22, 1, 'rls_regress_user2', 'great science fiction'),
( 7, 33, 2, 'rls_regress_user2', 'great technology book'), ( 7, 33, 2, 'rls_regress_user2', 'great technology book'),
( 8, 44, 1, 'rls_regress_user2', 'great manga'); ( 8, 44, 1, 'rls_regress_user2', 'great manga');
VACUUM ANALYZE category;
VACUUM ANALYZE document;
ALTER TABLE document ENABLE ROW LEVEL SECURITY; ALTER TABLE document ENABLE ROW LEVEL SECURITY;
-- user's security level must be higher than or equal to document's -- user's security level must be higher than or equal to document's
CREATE POLICY p1 ON document CREATE POLICY p1 ON document
...@@ -186,19 +184,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle); ...@@ -186,19 +184,20 @@ EXPLAIN (COSTS OFF) SELECT * FROM document WHERE f_leak(dtitle);
(7 rows) (7 rows)
EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle); EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dtitle);
QUERY PLAN QUERY PLAN
---------------------------------------------------------------- ----------------------------------------------------------------------
Nested Loop Hash Join
Join Filter: (document.cid = category.cid) Hash Cond: (category.cid = document.cid)
-> Subquery Scan on document
Filter: f_leak(document.dtitle)
-> Seq Scan on document document_1
Filter: (dlevel <= $0)
InitPlan 1 (returns $0)
-> Index Scan using uaccount_pkey on uaccount
Index Cond: (pguser = "current_user"())
-> Seq Scan on category -> Seq Scan on category
(10 rows) -> Hash
-> Subquery Scan on document
Filter: f_leak(document.dtitle)
-> Seq Scan on document document_1
Filter: (dlevel <= $0)
InitPlan 1 (returns $0)
-> Index Scan using uaccount_pkey on uaccount
Index Cond: (pguser = "current_user"())
(11 rows)
-- only owner can change policies -- only owner can change policies
ALTER POLICY p1 ON document USING (true); --fail ALTER POLICY p1 ON document USING (true); --fail
...@@ -276,12 +275,12 @@ EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dt ...@@ -276,12 +275,12 @@ EXPLAIN (COSTS OFF) SELECT * FROM document NATURAL JOIN category WHERE f_leak(dt
QUERY PLAN QUERY PLAN
---------------------------------------------------- ----------------------------------------------------
Nested Loop Nested Loop
Join Filter: (document.cid = category.cid)
-> Subquery Scan on document -> Subquery Scan on document
Filter: f_leak(document.dtitle) Filter: f_leak(document.dtitle)
-> Seq Scan on document document_1 -> Seq Scan on document document_1
Filter: (dauthor = "current_user"()) Filter: (dauthor = "current_user"())
-> Seq Scan on category -> Index Scan using category_pkey on category
Index Cond: (cid = document.cid)
(7 rows) (7 rows)
-- interaction of FK/PK constraints -- interaction of FK/PK constraints
...@@ -296,12 +295,12 @@ SET SESSION AUTHORIZATION rls_regress_user1; ...@@ -296,12 +295,12 @@ SET SESSION AUTHORIZATION rls_regress_user1;
SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid; SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid;
did | cid | dlevel | dauthor | dtitle | cid | cname did | cid | dlevel | dauthor | dtitle | cid | cname
-----+-----+--------+-------------------+--------------------+-----+------------ -----+-----+--------+-------------------+--------------------+-----+------------
1 | 11 | 1 | rls_regress_user1 | my first novel | 11 | novel
2 | 11 | 2 | rls_regress_user1 | my second novel | 11 | novel 2 | 11 | 2 | rls_regress_user1 | my second novel | 11 | novel
3 | 22 | 2 | rls_regress_user1 | my science fiction | | 1 | 11 | 1 | rls_regress_user1 | my first novel | 11 | novel
4 | 44 | 1 | rls_regress_user1 | my first manga | |
5 | 44 | 2 | rls_regress_user1 | my second manga | |
| | | | | 33 | technology | | | | | 33 | technology
5 | 44 | 2 | rls_regress_user1 | my second manga | |
4 | 44 | 1 | rls_regress_user1 | my first manga | |
3 | 22 | 2 | rls_regress_user1 | my science fiction | |
(6 rows) (6 rows)
DELETE FROM category WHERE cid = 33; -- fails with FK violation DELETE FROM category WHERE cid = 33; -- fails with FK violation
...@@ -313,8 +312,8 @@ SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid; ...@@ -313,8 +312,8 @@ SELECT * FROM document d FULL OUTER JOIN category c on d.cid = c.cid;
did | cid | dlevel | dauthor | dtitle | cid | cname did | cid | dlevel | dauthor | dtitle | cid | cname
-----+-----+--------+-------------------+-----------------------+-----+----------------- -----+-----+--------+-------------------+-----------------------+-----+-----------------
6 | 22 | 1 | rls_regress_user2 | great science fiction | 22 | science fiction 6 | 22 | 1 | rls_regress_user2 | great science fiction | 22 | science fiction
7 | 33 | 2 | rls_regress_user2 | great technology book | |
8 | 44 | 1 | rls_regress_user2 | great manga | 44 | manga 8 | 44 | 1 | rls_regress_user2 | great manga | 44 | manga
7 | 33 | 2 | rls_regress_user2 | great technology book | |
(3 rows) (3 rows)
INSERT INTO document VALUES (10, 33, 1, current_user, 'hoge'); INSERT INTO document VALUES (10, 33, 1, current_user, 'hoge');
......
...@@ -22,7 +22,7 @@ delete from gist_point_tbl where id % 2 = 1; ...@@ -22,7 +22,7 @@ delete from gist_point_tbl where id % 2 = 1;
-- would exercise it) -- would exercise it)
delete from gist_point_tbl where id < 10000; delete from gist_point_tbl where id < 10000;
vacuum gist_point_tbl; vacuum analyze gist_point_tbl;
-- --
...@@ -37,7 +37,7 @@ select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)), ...@@ -37,7 +37,7 @@ select box(point(0.05*i, 0.05*i), point(0.05*i, 0.05*i)),
circle(point(0.05*i, 0.05*i), 1.0) circle(point(0.05*i, 0.05*i), 1.0)
from generate_series(0,10000) as i; from generate_series(0,10000) as i;
vacuum analyze; vacuum analyze gist_tbl;
set enable_seqscan=off; set enable_seqscan=off;
set enable_bitmapscan=off; set enable_bitmapscan=off;
......
...@@ -82,9 +82,6 @@ INSERT INTO document VALUES ...@@ -82,9 +82,6 @@ INSERT INTO document VALUES
( 7, 33, 2, 'rls_regress_user2', 'great technology book'), ( 7, 33, 2, 'rls_regress_user2', 'great technology book'),
( 8, 44, 1, 'rls_regress_user2', 'great manga'); ( 8, 44, 1, 'rls_regress_user2', 'great manga');
VACUUM ANALYZE category;
VACUUM ANALYZE document;
ALTER TABLE document ENABLE ROW LEVEL SECURITY; ALTER TABLE document ENABLE ROW LEVEL SECURITY;
-- user's security level must be higher than or equal to document's -- user's security level must be higher than or equal to document's
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment