fix: prevent wrong returned entity in ReturningResultsEntityUpdator#6440
Conversation
|
I should probably add a test that validates this - I found it via cascades causing some other bug.. Problem is - I'm not sure the best way to test this functionality.. This is kind of an edge case that breaks via various other situations. |
in the `ReturningResultsEntityUpdator` we have to check that the `entityId` we pull from the entity is actually there. if we don't we will create a where clause that's undefined - effectively querying for every record in the database and returning the wrong value
cacfd33 to
96405cd
Compare
|
The question is: do we need to return error or just skip setting returning result? We need to know a real-case scenario of how this could happen and why |
|
At this moment it's a temporary defensive and preventative measure to throw an exception - preventing the incorrect return & invalid retrieval from the database. There's underlying issues that cause this behavior that haven't been determined yet. You can see this same technique is already used in the update method - https://github.com/typeorm/typeorm/pull/6440/files#diff-39f14c63414acd9b002e8d238893fa25L59 |
…ypeorm#6440) in the `ReturningResultsEntityUpdator` we have to check that the `entityId` we pull from the entity is actually there. if we don't we will create a where clause that's undefined - effectively querying for every record in the database and returning the wrong value
in the
ReturningResultsEntityUpdatorwe have to check that theentityIdwe pull from the entity is actually there. if we don't we will create a
where clause that's undefined - effectively querying for every record
in the database and returning the wrong value