Allon Mureinik has posted comments on this change. Change subject: core : DB FK validation ......................................................................
Patch Set 5: Looks good to me, but someone else must approve (4 inline comments) generally looks OK, but I have a few implementation concerns - see inline. .................................................... File backend/manager/dbscripts/common_sp.sql Line 564: where table_schema not in ('pg_catalog','information_schema') and table_type = 'BASE TABLE') AND Line 565: r.confrelid = c.oid AND Line 566: r.contype = 'f' AND Line 567: c2.oid = r.conrelid AND Line 568: pg_get_constraintdef(r.oid) not ilike '%ON DELETE SET %' What if a constraint is "ON DELETE SET NULL", but initially deffered? wouldn't we want to handle that too? Line 569: ORDER BY table_name; Line 570: Line 571: BEGIN Line 572: OPEN v_cur; Line 565: r.confrelid = c.oid AND Line 566: r.contype = 'f' AND Line 567: c2.oid = r.conrelid AND Line 568: pg_get_constraintdef(r.oid) not ilike '%ON DELETE SET %' Line 569: ORDER BY table_name; You're mixing conventions here - most of your keywords are uppercased, but some aren't, which is a bit confusing. Consider uppercasing all of them. Line 570: Line 571: BEGIN Line 572: OPEN v_cur; Line 573: LOOP Line 576: IF (v_fix_it) THEN Line 577: v_sql := 'delete from ' || v_record.fk_table_name || Line 578: ' where ' || v_record.fk_col || ' not in (select ' || Line 579: v_record.table_col || ' from ' || v_record.table_name || ');'; Line 580: v_msg := 'Fixing ' || v_record.fk_table_name || v_record.fk_col; They may be a pretty long transaction. Perhaps we should have the optional parameter allowing to commit after we're done with each table? Line 581: ELSE Line 582: v_sql := 'select ' || v_record.fk_col || ' from ' || v_record.fk_table_name || Line 583: ' where ' || v_record.fk_col || ' not in (select ' || Line 584: v_record.table_col || ' from ' || v_record.table_name || ');'; .................................................... Commit Message Line 6: Line 7: core : DB FK validation Line 8: Line 9: The purpose of this utility is to find inconsistent data that violates Line 10: FK(Forign Keys), display it and enable to remove it s/to remove/removing/ Line 11: Only support may access this utility with care Line 12: It is mandatory to run this utility on the original database before a Line 13: backup of the DB is taken for later Line 14: restore purpose, since if the database is backed up with the corrupted -- To view, visit http://gerrit.ovirt.org/10248 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibe54bca7a832c1c358a5e8c7214e7825cb9e4fc3 Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches