Skip to content

stringify integers outside JavaScript's safe range in JSON results - #210

Open
knQzx wants to merge 1 commit into
ClickHouse:mainfrom
knQzx:fix/stringify-large-integers
Open

stringify integers outside JavaScript's safe range in JSON results#210
knQzx wants to merge 1 commit into
ClickHouse:mainfrom
knQzx:fix/stringify-large-integers

Conversation

@knQzx

@knQzx knQzx commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

large ClickHouse integers (UInt64 and similar) exceed JS MAX_SAFE_INTEGER, so a JSON consumer parsing them as doubles silently corrupts the value (1875924584784080993 becomes 1875924584784081000)

recursively emit integers whose magnitude exceeds 2^53-1 as strings; smaller integers and booleans stay numeric

closes #111

Large ClickHouse integers (UInt64 and similar) exceed JavaScript's
MAX_SAFE_INTEGER, so a JSON consumer parsing them as doubles silently
corrupts the value (1875924584784080993 becomes 1875924584784081000).
Recursively emit integers whose magnitude exceeds 2^53-1 as strings in
the serialized tool result; smaller integers and booleans stay numeric.

Closes ClickHouse#111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UInt64 values get corrupted in JSON responses

1 participant