b_id = old.backup_id;
my_part_nr = old.part_nr - 1;
execute ''update backups set parts = parts - 1 where id = '' || b_id;
end if;
calc_part := (select count(part_nr) from backup_parts where backup_id = b_id);
if ( my_part_nr != calc_part ) then
b_id = old.backup_id;
my_part_nr = old.part_nr - 1;
execute ''update backups set parts = parts - 1 where id = '' || b_id;
end if;
calc_part := (select count(part_nr) from backup_parts where backup_id = b_id);
if ( my_part_nr != calc_part ) then