-
-
Notifications
You must be signed in to change notification settings - Fork 18
fix(orm): properly stringify typed-json values for postgres #498
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
Conversation
WalkthroughThis pull request enhances PostgreSQL CRUD dialect to differentiate TypeDef field handling from regular JSON fields. It introduces an isTypeDef check in transformPrimitive to conditionally stringify TypeDef values and adds regression tests validating JSON and typed-JSON persistence with PostgreSQL. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (5)📓 Common learnings📚 Learning: 2025-11-26T01:55:04.540ZApplied to files:
📚 Learning: 2025-11-26T01:55:04.540ZApplied to files:
📚 Learning: 2025-11-26T01:55:04.540ZApplied to files:
📚 Learning: 2025-10-21T16:09:31.218ZApplied to files:
🧬 Code graph analysis (2)tests/regression/test/issue-493.test.ts (1)
packages/orm/src/client/crud/dialects/postgresql.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude finished @ymc9's task —— View job PR Review: Properly stringify typed-json values for PostgreSQLReviewing the changes for code quality, potential issues, performance, and security concerns. Todo List:
Code Review SummaryThis PR addresses issue #493 by fixing how typed-JSON values are handled in PostgreSQL. The changes focus on proper JSON stringification for custom type definitions ( Key Changes
|
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.
Pull request overview
This PR fixes a bug in the PostgreSQL dialect where typed-JSON values (custom types defined with type keyword and marked with @json) were not being properly stringified before storage. This addresses issue #493 where arrays of custom types were being incorrectly handled by the node-postgres driver.
Key changes:
- Added proper handling for typed-JSON fields in PostgreSQL's
transformPrimitivemethod - Ensures typed-JSON values are stringified before storage, consistent with SQLite's behavior
- Added comprehensive regression test covering both plain JSON and typed-JSON scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/regression/test/issue-493.test.ts | Adds comprehensive regression test for PostgreSQL JSON and typed-JSON array handling |
| packages/orm/src/client/crud/dialects/postgresql.ts | Adds isTypeDef check and stringification logic for typed-JSON fields before array check |
The implementation is correct and follows the established pattern from the SQLite dialect. The test coverage is thorough, testing plain JSON (both array and non-array) as well as typed-JSON with nested custom types. No issues were found during the review.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
fixes #493 |
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.