Add BRIN test case

This test case was sketched in commit message 4c87010981 to explain an
ancient bug; it translates to a coverage increase, so add it to the BRIN
regression tests.
This commit is contained in:
Alvaro Herrera 2020-01-22 18:35:05 -03:00
parent 41c184bc64
commit 611ce856f5
2 changed files with 29 additions and 0 deletions

View File

@ -483,6 +483,25 @@ SELECT brin_summarize_range('brin_summarize_idx', -1);
ERROR: block number out of range: -1
SELECT brin_summarize_range('brin_summarize_idx', 4294967296);
ERROR: block number out of range: 4294967296
-- test value merging in add_value
CREATE TABLE brintest_2 (n numrange);
CREATE INDEX brinidx_2 ON brintest_2 USING brin (n);
INSERT INTO brintest_2 VALUES ('empty');
INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric));
INSERT INTO brintest_2 VALUES ('(-1, 0)');
SELECT brin_desummarize_range('brinidx', 0);
brin_desummarize_range
------------------------
(1 row)
SELECT brin_summarize_range('brinidx', 0);
brin_summarize_range
----------------------
1
(1 row)
DROP TABLE brintest_2;
-- test brin cost estimates behave sanely based on correlation of values
CREATE TABLE brin_test (a INT, b INT);
INSERT INTO brin_test SELECT x/100,x%100 FROM generate_series(1,10000) x(x);

View File

@ -448,6 +448,16 @@ SELECT brin_summarize_range('brin_summarize_idx', 4294967295);
SELECT brin_summarize_range('brin_summarize_idx', -1);
SELECT brin_summarize_range('brin_summarize_idx', 4294967296);
-- test value merging in add_value
CREATE TABLE brintest_2 (n numrange);
CREATE INDEX brinidx_2 ON brintest_2 USING brin (n);
INSERT INTO brintest_2 VALUES ('empty');
INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric));
INSERT INTO brintest_2 VALUES ('(-1, 0)');
SELECT brin_desummarize_range('brinidx', 0);
SELECT brin_summarize_range('brinidx', 0);
DROP TABLE brintest_2;
-- test brin cost estimates behave sanely based on correlation of values
CREATE TABLE brin_test (a INT, b INT);