-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
driver-adapters: Serialize i32 arguments as
number
(#4797)
* driver-adapters: Serialize i32 arguments as `number` Before this PR, we serialized all integers as bigint. This was not a problem for any of the adapters that supported bigint natively, however, it turned into a problem for D1. When we are doing order by aggregations, we inserd `ORDER BY COALESCE(count, 0)` into the query, where `0` is passed as i32 argument. As mentioned earlier, i32 argument got converted to `bigint` before this PR. In D1 adapter, we convert all bigints to strings. Which means, that above SQL query would become `ORDER BY COALESCE(count, '0')` now and produce different order for the rows where `count = NULL`. Since i32 bounds are below `Number.MAX_SAFE_INTEGER`, it is safe to convert it to `number` instead of `bigint`. `0` in above query is hardcoded to always be `i32`, so this fixes the issue. Close prisma/team-orm#1049 * fix(adapter-d1): uncomment remaining tests that now work --------- Co-authored-by: jkomyno <[email protected]>
- Loading branch information
Showing
7 changed files
with
13 additions
and
50 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
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
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