Update referential_integrity_assertions.js #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
changed the assertion name to include the parent and child keys. This allows referential integrity checks where the child table may have multiple columns referencing the same parent column. Previously this would have given a duplicate declaration name error.
changed the select statement from a left join to a right join, and filtering on where parent key is null. The previous left join and filtering on child key returns only rows in parents that do not exist in child. However, this does not mean that the rows in child are also in parent. Therefore this was not a true referential integrity check. Referential integrity check should check to make sure that every child value exists in the parent values.