Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Add BRIN test case
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 22 Jan 2020 21:35:05 +0000 (18:35 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 22 Jan 2020 21:37:39 +0000 (18:37 -0300)
This test case was sketched in commit message 4c87010981f3 to explain an
ancient bug; it translates to a coverage increase, so add it to the BRIN
regression tests.

src/test/regress/expected/brin.out
src/test/regress/sql/brin.sql

index ca80f00dc90f208a2d5cace0b2f8ae17b290999d..0b14c73fc6456c934409075d5bffeed1565f110d 100644 (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);
index 11f8fe9bb3261fc01567807e9f624bad4751cae5..1289e76ecb9b55521a68978450d701e63c62fdad 100644 (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);