-
Notifications
You must be signed in to change notification settings - Fork 132
Fix bigint serialization in pg-serializer #932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bigint serialization in pg-serializer #932
Conversation
- Add support for serializing BigInt values to strings - Fix error message to handle non-JSON-serializable values (like BigInt) which was causing a secondary "Do not know how to serialize a BigInt" error from JSON.stringify instead of the intended error message - Add comprehensive unit tests for pg-serializer with 100% coverage
🦋 Changeset detectedLatest commit: 6900878 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 87.1 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.34 kB ℹ️ View Unchanged
|
|
@KyleAMathews looks good but perhaps we should add an e2e test to validate that this works when using a bigint as a predicate that's pushed to electric. I'm 99% sure this will work. |
samwillis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…down Add e2e tests to verify BigInt values work correctly when used as predicates that are pushed to Electric: - Test eq() with BigInt on BIGINT column - Test inArray() with BigInt array on BIGINT column Both tests use values exceeding Number.MAX_SAFE_INTEGER to ensure the serialization preserves precision.
Move BigInt predicate tests from Electric-specific to the shared test suite so they run for all collection implementations: - Add `largeViewCount: bigint` field to Post type - Generate seed data with BigInt values exceeding MAX_SAFE_INTEGER - Add eq() and gt() tests for BigInt comparison operators - Add inArray() test for BigInt array predicates - Update Electric e2e test setup to include the new BIGINT column This ensures BigInt serialization is tested across all collection backends, not just Electric.
…ilter Add BigInt handling to serializeValue function to prevent "Do not know how to serialize a BigInt" error when using BigInt values in predicates with Query collections.
|
Ah good call, added an e2e test |
|
🎉 This PR has been released! Thank you for your contribution! |
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact