From 6eb9c5a5657d1fe77b55cc261450f3538d35a94d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 14:19:15 +0200 Subject: Adding upstream version 13.4. Signed-off-by: Daniel Baumann --- src/test/isolation/specs/vacuum-reltuples.spec | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/test/isolation/specs/vacuum-reltuples.spec (limited to 'src/test/isolation/specs/vacuum-reltuples.spec') diff --git a/src/test/isolation/specs/vacuum-reltuples.spec b/src/test/isolation/specs/vacuum-reltuples.spec new file mode 100644 index 0000000..ae2f79b --- /dev/null +++ b/src/test/isolation/specs/vacuum-reltuples.spec @@ -0,0 +1,48 @@ +# Test for vacuum's handling of reltuples when pages are skipped due +# to page pins. We absolutely need to avoid setting reltuples=0 in +# such cases, since that interferes badly with planning. +# +# Expected result in second permutation is 20 tuples rather than 21 as +# for the others, because vacuum should leave the previous result +# (from before the insert) in place. + +setup { + create table smalltbl + as select i as id from generate_series(1,20) i; + alter table smalltbl set (autovacuum_enabled = off); +} +setup { + vacuum analyze smalltbl; +} + +teardown { + drop table smalltbl; +} + +session worker +step open { + begin; + declare c1 cursor for select 1 as dummy from smalltbl; +} +step fetch1 { + fetch next from c1; +} +step close { + commit; +} +step stats { + select relpages, reltuples from pg_class + where oid='smalltbl'::regclass; +} + +session vacuumer +step vac { + vacuum smalltbl; +} +step modify { + insert into smalltbl select max(id)+1 from smalltbl; +} + +permutation modify vac stats +permutation modify open fetch1 vac close stats +permutation modify vac stats -- cgit v1.2.3