X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=sql%2F09_backup_parts_trigger.sql;fp=sql%2F09_backup_parts_trigger.sql;h=6c72fd4ad7057bcdc282a6c4adb377ede23a2132;hp=c48163c86aba19a79090fa2914305331e3b1d754;hb=09c735385267b44e05ab8bbdbe92400bc60a8436;hpb=c5f4d5e4857aebfa61fc4043d5efd2309e9b074b diff --git a/sql/09_backup_parts_trigger.sql b/sql/09_backup_parts_trigger.sql index c48163c..6c72fd4 100644 --- a/sql/09_backup_parts_trigger.sql +++ b/sql/09_backup_parts_trigger.sql @@ -37,20 +37,19 @@ declare calc_part integer; begin if (TG_OP = ''INSERT'') then - raise notice ''trigger: % backup_id %'', TG_OP, new.backup_id; + -- raise notice ''trigger: % backup_id %'', TG_OP, new.backup_id; b_id = new.backup_id; my_part_nr = new.part_nr; execute ''update backups set parts = parts + 1 where id = '' || b_id; elsif (TG_OP = ''DELETE'') then - raise notice ''trigger: % backup_id %, old.part_nr %'', TG_OP, old.backup_id, old.part_nr; + -- raise notice ''trigger: % backup_id %, old.part_nr %'', TG_OP, old.backup_id, old.part_nr; 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 - raise exception ''Update of backup_parts with backup_id % aborted, requested part_nr is % and calulated next is %'', b_id, my_part_nr, calc_part; - + raise exception ''Update of backup_parts with backup_id % aborted, requested part_nr is % and calulated next is %'', b_id, my_part_nr, calc_part; end if; return null; end;