Files
Melanie Plageman b93961add9 Stabilize btree_gist test against on-access VM setting
The btree_gist enum test expects a bitmap heap scan. Since 0172721d14
enabled setting the VM during on-access pruning and 502167cfe set
pd_prune_xid on INSERT, scans of enumtmp may set pages all-visible.
If autovacuum or autoanalyze then updates pg_class.relallvisible, the
planner could choose an index-only scan instead.

Make the enumtmp a temp table to exclude it from autovacuum/autoanalyze.

Reported-by: Alexander Lakhin <[email protected]>
Author: Melanie Plageman <[email protected]>
Discussion: https://postgr.es/m/46733d68-aec0-4d09-8120-4c66b87047a4%40gmail.com
2026-04-21 17:32:45 -04:00

43 lines
1.1 KiB
SQL

-- enum check
create type rainbow as enum ('r','o','g','b','i','v');
-- enum values added later take some different codepaths internally,
-- so make sure we have coverage for those too
alter type rainbow add value 'y' before 'g';
CREATE TEMPORARY TABLE enumtmp (a rainbow);
\copy enumtmp from 'data/enum.data'
SET enable_seqscan=on;
select a, count(*) from enumtmp group by a order by 1;
SELECT count(*) FROM enumtmp WHERE a < 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a <= 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a = 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a > 'g'::rainbow;
CREATE INDEX enumidx ON enumtmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM enumtmp WHERE a < 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a <= 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a = 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow;
SELECT count(*) FROM enumtmp WHERE a > 'g'::rainbow;
EXPLAIN (COSTS OFF)
SELECT count(*) FROM enumtmp WHERE a >= 'g'::rainbow;