Skip to content

Commit 611ce85

Browse files
committed
Add BRIN test case
This test case was sketched in commit message 4c87010 to explain an ancient bug; it translates to a coverage increase, so add it to the BRIN regression tests.
1 parent 41c184b commit 611ce85

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/test/regress/expected/brin.out

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,25 @@ SELECT brin_summarize_range('brin_summarize_idx', -1);
483483
ERROR: block number out of range: -1
484484
SELECT brin_summarize_range('brin_summarize_idx', 4294967296);
485485
ERROR: block number out of range: 4294967296
486+
-- test value merging in add_value
487+
CREATE TABLE brintest_2 (n numrange);
488+
CREATE INDEX brinidx_2 ON brintest_2 USING brin (n);
489+
INSERT INTO brintest_2 VALUES ('empty');
490+
INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric));
491+
INSERT INTO brintest_2 VALUES ('(-1, 0)');
492+
SELECT brin_desummarize_range('brinidx', 0);
493+
brin_desummarize_range
494+
------------------------
495+
496+
(1 row)
497+
498+
SELECT brin_summarize_range('brinidx', 0);
499+
brin_summarize_range
500+
----------------------
501+
1
502+
(1 row)
503+
504+
DROP TABLE brintest_2;
486505
-- test brin cost estimates behave sanely based on correlation of values
487506
CREATE TABLE brin_test (a INT, b INT);
488507
INSERT INTO brin_test SELECT x/100,x%100 FROM generate_series(1,10000) x(x);

src/test/regress/sql/brin.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,16 @@ SELECT brin_summarize_range('brin_summarize_idx', 4294967295);
448448
SELECT brin_summarize_range('brin_summarize_idx', -1);
449449
SELECT brin_summarize_range('brin_summarize_idx', 4294967296);
450450

451+
-- test value merging in add_value
452+
CREATE TABLE brintest_2 (n numrange);
453+
CREATE INDEX brinidx_2 ON brintest_2 USING brin (n);
454+
INSERT INTO brintest_2 VALUES ('empty');
455+
INSERT INTO brintest_2 VALUES (numrange(0, 2^1000::numeric));
456+
INSERT INTO brintest_2 VALUES ('(-1, 0)');
457+
458+
SELECT brin_desummarize_range('brinidx', 0);
459+
SELECT brin_summarize_range('brinidx', 0);
460+
DROP TABLE brintest_2;
451461

452462
-- test brin cost estimates behave sanely based on correlation of values
453463
CREATE TABLE brin_test (a INT, b INT);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy