Eli Mesika has uploaded a new change for review.

Change subject: core: Installer pre-upgrade step should ensure...
......................................................................

core: Installer pre-upgrade step should ensure...

Installer pre-upgrade step should ensure DB consistency using fkvalidator.sh

Fixing a problem in fkvalidator when the child table has a value that
not exists in the parent table but this value is null.
In that case fkvalidaor should not treat that data as a violation.

Change-Id: Id76d9c3e3d619ac591a334b481c8af9ca675af9e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=893459
Signed-off-by: Eli Mesika <[email protected]>
---
M backend/manager/tools/dbutils/fkvalidator_sp.sql
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/14597/1

diff --git a/backend/manager/tools/dbutils/fkvalidator_sp.sql 
b/backend/manager/tools/dbutils/fkvalidator_sp.sql
index 93f7feb..2439098 100644
--- a/backend/manager/tools/dbutils/fkvalidator_sp.sql
+++ b/backend/manager/tools/dbutils/fkvalidator_sp.sql
@@ -36,12 +36,12 @@
         v_record.fk_status := 0;
         IF (v_fix_it) THEN
             v_sql := 'delete from ' || v_record.fk_table_name ||
-                      ' where ' || v_record.fk_col || ' not in (select ' ||
+                      ' where ' || v_record.fk_col || 'IS NOT NULL and '  || 
v_record.fk_col || ' not in (select ' ||
                       v_record.table_col || ' from ' || v_record.table_name || 
');';
             v_msg := 'Fixing ' ||  v_record.fk_table_name || v_record.fk_col;
         ELSE
             v_sql := 'select ' || v_record.fk_col || ' from ' || 
v_record.fk_table_name ||
-                      ' where ' || v_record.fk_col || ' not in (select ' ||
+                      ' where ' || v_record.fk_col || 'IS NOT NULL and ' || 
v_record.fk_col || ' not in (select ' ||
                       v_record.table_col || ' from ' || v_record.table_name || 
');';
             v_msg := 'Constraint violation found in  ' ||  
v_record.fk_table_name || v_record.fk_col;
         END IF;


--
To view, visit http://gerrit.ovirt.org/14597
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id76d9c3e3d619ac591a334b481c8af9ca675af9e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to