You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[kind/bug] BIGINT cell values lose precision past 2^53 #502
Surfaced while adding tauri-specta (#502). specta refuses to export u64/i64 to TypeScript by default, precisely to stop this class of bug — which made an existing one visible.
Problem
SqlValue carries cell values across IPC:
pubenumSqlValue{Int(i64),UInt(u64),
...
}
serde_json serialises these as JSON numbers, and JSON.parse truncates anything past 2^53 into a double. So a BIGINT column holding e.g. 9007199254740993 is displayed, copied and exported by the grid as 9007199254740992.
This is not new — it is how the app has always behaved, and the hand-written TypeScript typed these as number. In #502 the fields are annotated #[specta(type = f64)], which documents the existing lossy round-trip rather than introducing or fixing it.
Impact
Silent and plausible-looking: no error, just a wrong digit. Worst in the paths where the value is trusted — copy cell, copy row, copy as INSERT, and CSV/JSON/SQL export — because a truncated id can be pasted straight into another query.
Snowflake ids, BIGINT UNSIGNED primary keys and hash columns are the realistic cases.
Options
Serialise the affected variants as strings (#[serde(with = ...)] plus #[specta(type = String)]), and have the grid render them as text. Lossless. Costs a type change at the boundary and some care wherever a cell value is treated as numeric.
Keep numbers but detect |v| > Number.MAX_SAFE_INTEGER on the Rust side and send those as strings. Narrower blast radius, but a union type to handle in the grid.
Accept and document. Cheapest, still wrong for real BIGINT keys.
Option 1 is the honest fix; option 2 limits churn.
Activity
fix(query): stop decode failures masquerading as NULL
fix(query): stop decode failures masquerading as NULL (#509)