Fixing issue with multiple relations to same table #14131
Merged
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.
Description
There was an issue with multiple relationships to the same table and SQS - as SQS uses a single junction table (no matter how many relationships) between the two tables. This is a bit more efficient than creating junction tables for every relationship and we have the information in the junction to decipher the relationships between their different columns (although we weren't doing this).
This created a problem when you had multiple relationships to the same table where all rows that were related would end up in every column, if you removed from one column it wouldn't understand what to do, as it might not be present in that column.
I've added a test case for internal tables for this, it doesn't impact external tables and is a relatively pointless test as relationships depend on foreign keys and specific configuration for external.