drizzle-team / drizzle-team/drizzle-orm
[BUG]: Replica used with write subqueries
Open
bug
priority
qb/crud
- 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.40.0
### What version of `drizzle-kit` are you using?
0.30.5
### Other packages
_No response_
### Describe the Bug
A `SELECT` query with write subqueries (`INSERT`, `UPDATE`, etc) is trying to use the replicas instead of the primary database.
Example:
```ts
const updateSq = postgres.$with('update').as(
postgres
.update(table)
.set({
foo: 'bar'
})
)
const result = await postgres.with(updateSq).select().from(table)
```
Contributor guide
Assessment
This issue has not been assessed yet.