feat: add bigint column type support and update dependencies#2950
feat: add bigint column type support and update dependencies#2950ArnabChatterjee20k wants to merge 5 commits intomainfrom
Conversation
Greptile SummaryThis PR adds BigInt column type support to the Tables DB UI and upgrades the Key changes:
Issues found:
Confidence Score: 4/5Mostly safe to merge; the most critical prior concerns were addressed, but a known P1 concern around Two previously flagged P1 issues were fixed (wrong model type
Important Files Changed
Reviews (4): Last reviewed commit: "linting" | Re-trigger Greptile |
| case 'bigint': | ||
| case 'integer': { | ||
| const int = parseInt(trimmed, 10); | ||
| return isNaN(int) ? null : int; |
There was a problem hiding this comment.
parseInt silently loses precision for large BigInt values
When column.type === 'bigint', this code falls through to parseInt(trimmed, 10), which returns a JavaScript number. JavaScript number is a 64-bit float with only 53 bits of mantissa, meaning any integer beyond Number.MAX_SAFE_INTEGER (~9×10¹⁵) is silently corrupted.
For example:
parseInt("9007199254740993", 10) // → 9007199254740992 (wrong, off by 1)
BigInt columns in most databases support 64-bit integers (up to ~9.2×10¹⁸), so real values in the upper range of a bigint column will be silently truncated/rounded when saved through this path.
The correct approach is to use BigInt() for the bigint case:
case 'bigint': {
try {
return BigInt(trimmed);
} catch {
return null;
}
}
case 'integer': {
const int = parseInt(trimmed, 10);
return isNaN(int) ? null : int;
}Note that adopting BigInt also requires updating the parseValue return type (number | bigint | boolean | string | null) and ensuring the JSON.stringify comparison in the reactive $effect blocks handles BigInt (since JSON.stringify(BigInt(1)) throws a TypeError).
There was a problem hiding this comment.
Big int is just a split off from the Integer. Earlier integer only handled bigint with this, now a separate type
...project-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte
Outdated
Show resolved
Hide resolved
.../project-[region]-[project]/databases/database-[database]/table-[table]/columns/+page.svelte
Outdated
Show resolved
Hide resolved
...project-[region]-[project]/databases/database-[database]/table-[table]/columns/bigint.svelte
Show resolved
Hide resolved
- Updated bigint column type handling in the database table columns. - Refactored input components to use InputText for bigint values with validation. - Improved parsing and error handling for bigint inputs in string representation. - Adjusted type definitions to include bigint in various contexts.
- Added bigint type to the Columns type definition. - Updated bigint input handling in the bigint.svelte component, replacing InputText with InputNumber for better user experience. - Enhanced data binding and validation for bigint values, including min, max, and default settings. - Adjusted column value handling in various components to accommodate bigint type.
What does this PR do?
(Provide a description of what this PR does.)
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)
Related PRs and Issues
(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)
Have you read the Contributing Guidelines on issues?
(Write your answer here.)