Skip to content

Commit 4c51a2d

Browse files
committed
Improve test coverage of ginvacuum.c.
Add a test case that exercises vacuum's deletion of empty GIN posting pages. Since this is a temp table, it should now work reliably to delete a bunch of rows and immediately VACUUM. Before the preceding commit, this would not have had the desired effect, at least not in parallel regression tests. Discussion: https://postgr.es/m/3490536.1598629609@sss.pgh.pa.us
1 parent a7212be commit 4c51a2d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/test/regress/expected/gin.out

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,27 @@ select count(*) from t_gin_test_tbl where j @> '{}'::int[];
264264
20006
265265
(1 row)
266266

267+
-- test vacuuming of posting trees
268+
delete from t_gin_test_tbl where j @> array[2];
269+
vacuum t_gin_test_tbl;
270+
select count(*) from t_gin_test_tbl where j @> array[50];
271+
count
272+
-------
273+
0
274+
(1 row)
275+
276+
select count(*) from t_gin_test_tbl where j @> array[2];
277+
count
278+
-------
279+
0
280+
(1 row)
281+
282+
select count(*) from t_gin_test_tbl where j @> '{}'::int[];
283+
count
284+
-------
285+
6
286+
(1 row)
287+
267288
reset enable_seqscan;
268289
reset enable_bitmapscan;
269290
drop table t_gin_test_tbl;

src/test/regress/sql/gin.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ explain (costs off)
159159
select count(*) from t_gin_test_tbl where j @> '{}'::int[];
160160
select count(*) from t_gin_test_tbl where j @> '{}'::int[];
161161

162+
-- test vacuuming of posting trees
163+
delete from t_gin_test_tbl where j @> array[2];
164+
vacuum t_gin_test_tbl;
165+
166+
select count(*) from t_gin_test_tbl where j @> array[50];
167+
select count(*) from t_gin_test_tbl where j @> array[2];
168+
select count(*) from t_gin_test_tbl where j @> '{}'::int[];
169+
162170
reset enable_seqscan;
163171
reset enable_bitmapscan;
164172

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