drizzle-team / drizzle-team/drizzle-orm

[BUG]: Bun SQL does not serialize JSON values

Open Beginner friendly
#6,132 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

1.0.0-rc.5-169397b

### What version of `drizzle-kit` are you using?

1.0.0-rc.5-ab785fc

### Other packages

_No response_

### Describe the Bug

With `drizzle-orm@1.0.0-rc.5-169397b`, inserting an object into a` json` or `jsonb` column fails:
`invalid input syntax for type json`

I had to extend `bunSqlPgCodecs` with:
`normalizeParam: (value) => JSON.stringify(value)`

Expected: `bunSqlPgCodecs` should serialize JSON objects automatically, like other PostgreSQL drivers.

Contributor guide

Open the contributing guide

Research direction

Search the TypeScript source for bunSqlPgCodecs and trace how values are normalized before PostgreSQL insertion. Reproduce the failure with an object in a json or jsonb column, then verify that Bun SQL serializes JSON objects automatically like the other PostgreSQL drivers.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, postgresql, typescript
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.