-- Create a table large enough to have an FSM, then delete most records.
-- The FSM will stay around, but will not be transferred during pg_upgrade.
drop table fsm_no_copy;
create table fsm_no_copy (num int);
insert into fsm_no_copy select g from generate_series(1,5000) g;
delete from fsm_no_copy where num > 1;
vacuum fsm_no_copy;

-- Create table with an FSM whose index also has an FSM.
-- This tests that an index smaller than the heap threshold will still transfer.
drop table fsm_copy;
create table fsm_copy (num int);
insert into fsm_copy select g from generate_series(0,5000) g;
create index on fsm_copy using brin (num);

-- Run on both clusters to show what got transferred.
select
	relname, relkind, relfilenode,
	pg_relation_size(relname::regclass) as mainsize,
	pg_relation_size(relname::regclass, 'fsm') as fsmsize
from pg_class 
where relname like 'fsm%'
order by relname;
