@@ -36,19 +36,23 @@ INSERT INTO heaptest (a, b)
36
36
--
37
37
-- Create an alternative tablespace and move the heaptest table to it, causing
38
38
-- it to be rewritten and all the blocks to reliably evicted from shared
39
- -- buffers -- guaranteeing actual reads when we next select from it.
39
+ -- buffers -- guaranteeing actual reads when we next select from it in the
40
+ -- same transaction. The heaptest table is smaller than the default
41
+ -- wal_skip_threshold, so a wal_level=minimal commit reads the table into
42
+ -- shared_buffers. A transaction delays that and excludes any autovacuum.
40
43
SET allow_in_place_tablespaces= true;
41
44
CREATE TABLESPACE regress_test_stats_tblspc LOCATION' ' ;
42
45
SELECT sum (reads)AS stats_bulkreads_before
43
46
FROM pg_stat_ioWHERE context= ' bulkread' \gset
47
+ BEGIN ;
44
48
ALTER TABLE heaptestSET TABLESPACE regress_test_stats_tblspc;
45
-
46
49
-- Check that valid options are not rejected nor corruption reported
47
50
-- for a non-empty table
48
51
SELECT * FROM verify_heapam(relation := ' heaptest' , skip := ' none' );
49
52
SELECT * FROM verify_heapam(relation := ' heaptest' , skip := ' all-frozen' );
50
53
SELECT * FROM verify_heapam(relation := ' heaptest' , skip := ' all-visible' );
51
54
SELECT * FROM verify_heapam(relation := ' heaptest' , startblock := 0 , endblock := 0 );
55
+ COMMIT ;
52
56
53
57
-- verify_heapam should have read in the page written out by
54
58
-- ALTER TABLE ... SET TABLESPACE ...