Skip to content

Commit

Permalink
0005622: Prevented deletes from being ignored when FK children exist …
Browse files Browse the repository at this point in the history
…but cannot be found
  • Loading branch information
evan-miller-jumpmind committed Dec 12, 2022
1 parent 80c54e2 commit 4a16574
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -555,7 +555,12 @@ protected boolean checkForForeignKeyChildExistsViolation(AbstractDatabaseWriter
log.info("Child exists foreign key violation on table {} during {} with batch {}. Attempting to correct.",
targetTable.getName(), data.getDataEventType().toString(), writer.getContext().getBatch().getNodeBatchId());

return deleteForeignKeyChildren(platform, sqlTemplate, databaseWriter, writer.getTargetTable(), data);
if (deleteForeignKeyChildren(platform, sqlTemplate, databaseWriter, writer.getTargetTable(), data)) {
return true;
} else {
throw new RuntimeException("Failed to delete foreign table rows to fix foreign key violation for table '"
+ writer.getTargetTable().getFullyQualifiedTableName() + "'");
}
}
return false;
}
Expand Down

0 comments on commit 4a16574

Please sign in to comment.