begin;

with tail as (select max(id) from tbl)
insert into tbl
	select  CASE
     WHEN i%100 > 1 and i%100<50 THEN i-tail.max
     ELSE i
     END i, i

	from tail, generate_series(tail.max+1,tail.max+1000) as i
	on conflict (id) do update set a=EXCLUDED.a*10;


commit;

begin;

insert into tbl select i, i from generate_series(0,1000) as i
on conflict (id) do update set a=EXCLUDED.a*10;


insert into tbl select i, i from generate_series(0,1000) as i
on conflict (id) do update set a=EXCLUDED.a*10;

abort;