We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
drizzle-orm
0.33.0
drizzle-kit
0.23.0
I'm using drizzle + node postgres.
When I store a string e.g. "10.5" under a jsonb column, I expect it to be returned as "10.5" in string format. Instead it's returned as 10.5
"10.5"
This is probably because node-postgres does JSON.parse once, and then the jsonb column does it again.
When I store a string e.g. "10.5" under a jsonb column, I expect it to be returned as "10.5" in string format.
drizzle + node postgres computer: macos
The text was updated successfully, but these errors were encountered:
to work around this for now, either create a customJsonb type like this:
customJsonb
import { customType } from "drizzle-orm/pg-core"; const jsonb = customType<{ data: unknown; driverData: string; config: undefined; }>({ dataType() { return `jsonb`; }, fromDriver(value: string): unknown { return value; }, toDriver(value: unknown): string { return JSON.stringify(value); }, });
OR remove JSON.parse from node-postgres's jsonb type parser via:
JSON.parse
import { types } from "pg"; types.setTypeParser(types.builtins.JSONB, (val) => val);
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
What version of
drizzle-orm
are you using?0.33.0
What version of
drizzle-kit
are you using?0.23.0
Describe the Bug
I'm using drizzle + node postgres.
When I store a string e.g.
"10.5"
under a jsonb column, I expect it to be returned as "10.5" in string format. Instead it's returned as 10.5This is probably because node-postgres does JSON.parse once, and then the jsonb column does it again.
Expected behavior
When I store a string e.g.
"10.5"
under a jsonb column, I expect it to be returned as "10.5" in string format.Environment & setup
drizzle + node postgres
computer: macos
The text was updated successfully, but these errors were encountered: