Closed robinjonsson closed 11 months ago
Possible workaround:
const results = await conn.execute(
`SELECT json_object('id', CAST(id as CHAR)) as user FROM users`
);
I'm not exactly sure where something is being lost in translation here, but in JSON, there is no "bigint". JSON has "numbers" which are a float64.
In our driver, we had some internal discussions about supporting bigint types natively when they are expressed over the wire, and we chose to express them as just JavaScript numbers.
https://github.com/planetscale/database-js/pull/90
But this is why int64 typically is represented as a string in JavaScript since you lose precision outside of the BigInt type.
Hi,
When you use
json_object
, bigints are converted to numbers and not strings. Is that the intended behavior?Example:
Schema:
Query:
Output: