
create table gintest (i int4);
insert into gintest select g from generate_series(1, 7963) g;

create index i_gintest on gintest using gin (('{1}'::int4[])) with (fastupdate=on) where i > 0 ;


select * from  gin_dataleafpage(get_raw_page('i_gintest', 2));

-- Delete some items, so that one segment becomes very small.
delete from gintest where i between 7150 and 7500;
vacuum gintest;

-- Insert more tuples, to occupy the space. These are not included in the index
insert into gintest select -g from generate_series(1, 350) g;

select * from  gin_dataleafpage(get_raw_page('i_gintest', 2));

-- insert more items, causing a split
insert into gintest select g from generate_series(1, 1000) g;
vacuum gintest;
