hypopg/test/sql/hypo_brin.sql
Julien Rouhaud 723adb4bb9 Warn about broken hypothetical BRIN indexes in some minor versions.
Hypothetical BRIN indexes are broken in some minor versions of pg10, pg11 and
pg12.  Detect those versions and warn users with a useful error message
recommending to update their minor versions of postgres.

Also add regression tests to make sure that support BRIN hypothetical indexes
doesn't get broken again.
2020-02-22 14:42:31 +01:00

18 lines
462 B
SQL

-- Hypothetical BRIN index tests
CREATE TABLE hypo_brin (id integer);
INSERT INTO hypo_brin SELECT generate_series(1, 10000);
ANALYZE hypo_brin;
SELECT COUNT(*) AS nb
FROM public.hypopg_create_index('CREATE INDEX ON hypo_brin USING brin (id);');
-- Should use hypothetical index
SET enable_seqscan = 0;
SELECT COUNT(*) FROM do_explain('SELECT * FROM hypo_brin WHERE id = 1') e
WHERE e ~ 'Bitmap Index Scan on <\d+>brin_hypo_brin.*';
DROP TABLE hypo_brin;