-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client): Fix incorrect field transformation in queries including …
…related tables (#1107) Fixes #1095 All operations must remain synchronous and use callbacks and continuations due to some driver limitations, which led to the passing around of `DB` instances that had field transformation and validation incorporated for a specific table. This was not an issue for most cases as either related tables won't have shared column names, or if they do they are likely to also share the type and thus the field transformation worked. In cases where a related table might have a column with the same name as the source table but a different type, the `DB` instance would try to validate/transform the related table column with the assumption that it is of the type of the source table column, leading to either 1) incorrect transformations (like stringified jsons) or 2) errors in attempts to transform (like strings being parsed as jsons) I've added a few tests for this case and a workaround by allowing the DB instances to be cloned with a different table schema. I'd prefer a cleaner solution but it might require significant refactoring so I think this will do the trick for now - the bug is serious enough that I think we should take care of it ASAP.
- Loading branch information
Showing
10 changed files
with
359 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"electric-sql": patch | ||
--- | ||
|
||
Fixed incorrect field transformation for queries with included relations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.