drizzle-team / drizzle-team/drizzle-orm
[BUG]: Prepared statements don't work with postgres.js
- 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?
0.45.1
### What version of `drizzle-kit` are you using?
0.31.10
### Other packages
_No response_
### Describe the Bug
Prepared queries are broken when using driver `postgres.js`.
# Reproducing
1. Download a zip from: https://gist.github.com/nesk/39f820833e00886f5bb1ccd83c0003d2
1. `npm install`
2. `docker run --rm --name drizzle-postgres -e POSTGRES_PASSWORD=mypassword -p 5434:5432 postgres -c log_statement=all -c log_min_duration_statement=0`
3. Open a new shell and run `npx drizzle-kit push`
4. Run `npx tsx postgres-js.ts`
## Expected
Logs from `docker run` command should contain only **one** occurence of:
```
parse insert_user: insert into "users" ("id", "name", "age", "email") values (default, $1, $2, $3)
```
And two occurences of:
```
execute insert_user: insert into "users" ("id", "name", "age", "email") values (default, $1, $2, $3)
```
`npx tsx node-postgres.ts` works as expected.
## Actual
Logs from `docker run` contain **two** occurences of:
```
parse : insert into "users" ("id", "name", "age", "email") values (default, $1, $2, $3)
```
And we can see that the query isn't named, using `` instead.
`npx tsx postgres-js.ts` doesn't work as expected, despite being identical to `npx tsx node-postgres.ts`.
Contributor guide
Assessment
This issue has not been assessed yet.