Bug description
When using @prisma/adapter-pg with Prisma 7, the following deprecation warning is emitted at runtime when an update is run, with multiple includes (see below for detailed example and detailed logs)
Calling client.query() when the client is already executing a query is deprecated
and will be removed in pg@9.0. Use async/await or an external async flow control
mechanism instead.
I think the Array.map in interpretNode is dispatching multiple performIO calls concurrently onto the same PgTransaction client. Since PgTransaction holds a single pg Client (not a Pool), concurrent client.query() calls on it trigger the deprecation.
This will become a hard error in pg@9.0.
Severity
🔹 Minor: Unexpected behavior, but does not block development
Reproduction
An update with multiple include relations triggers it reliably (see below).
Notes:
- The warning does not originate from user code — confirmed by full stack trace
- Passing an explicit
pg.Pool with max > 1 to PrismaPg does not resolve it
- Does not reproduce on
findUnique with a similar include shape — appears specific to write operations that open an implicit transaction and then fetch relations on the same connection
Expected vs. Actual Behavior
Expected: - Shouldn't log a warning (will break in next pg major version)
Actual Behavior: - Shows a warning (see below)
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Warning occurs since pg 8.20.0 (via Prisma 7.5), but behavior is unchanged on Prisma's side.
Workaround
Downgrade to pg to 8.18
Prisma Schema & Queries
model Parent {
id String @id @default(cuid())
RelationA SomeRelationA[]
RelationB SomeRelationB[]
RelationC SomeRelationC[]
}
model SomeRelationA {
id String @id @default(cuid())
parentId String
Parent Parent @relation(fields: [parentId], references: [id])
}
model SomeRelationB {
// Similar as above
}
model SomeRelationC {
// Similar as above
}
await prisma.parent.update({
where: { id: args.id },
data: {},
include: {
RelationA: { orderBy: { order: 'asc' } },
RelationB: { orderBy: { order: 'asc' } },
RelationC: { orderBy: { order: 'asc' } },
},
})
Prisma Config
export default {
schema: path.join('prisma', 'schema'),
migrations: {
path: path.join('prisma', 'migrations'),
seed: 'tsx prisma/seed',
},
datasource: DATABASE_URL ? { url: DATABASE_URL } : undefined,
} satisfies PrismaConfig
Logs & Debug Info
Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.
DeprecationWarning: Calling client.query() when the client is already executing a query is deprecated and will be removed in pg@9.0. Use async/await or an external async flow control mechanism instead.
at Client.query (/MY_PATH/node_modules/pg/lib/client.js:691:7)
at PgTransaction.performIO (/MY_PATH/.next/dev/server/chunks/ssr/[root-of-the-server]__044le1t._.js:4548:46)
at PgTransaction.queryRaw (/MY_PATH/.next/dev/server/chunks/ssr/[root-of-the-server]__044le1t._.js:4500:45)
at /MY_PATH/node_modules/@prisma/client/runtime/client.js:11:44617
at xr (/MY_PATH/node_modules/@prisma/client/runtime/client.js:11:26620)
at #u (/MY_PATH/node_modules/@prisma/client/runtime/client.js:11:47917)
at e.interpretNode (/MY_PATH/node_modules/@prisma/client/runtime/client.js:11:44586)
at /MY_PATH/node_modules/@prisma/client/runtime/client.js:11:45739
at Array.map (<anonymous>)
at e.interpretNode (/MY_PATH/node_modules/@prisma/client/runtime/client.js:11:45688)
at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
Environment & Setup
- OS: macOs Tahoe 26.3 (25D125)
- Database: Postgres 15
- Node.js version: v24.13.0
Also happens in prod on Vercel with Node 24
Prisma Version
prisma : 7.5.0
@prisma/client : 7.5.0
Operating System : darwin
Architecture : arm64
Node.js : v24.13.0
TypeScript : 6.0.2
Query Compiler : enabled
PSL : @prisma/prisma-schema-wasm 7.5.0-15.280c870be64f457428992c43c1f6d557fab6e29e
Schema Engine : schema-engine-cli 280c870be64f457428992c43c1f6d557fab6e29e (at node_modules/@prisma/engines/schema-engine-darwin-arm64)
Default Engines Hash : 280c870be64f457428992c43c1f6d557fab6e29e
Studio : 0.21.1
Preview Features : typedSql, views
Bug description
When using
@prisma/adapter-pgwith Prisma 7, the following deprecation warning is emitted at runtime when an update is run, with multiple includes (see below for detailed example and detailed logs)I think the
Array.mapininterpretNodeis dispatching multipleperformIOcalls concurrently onto the samePgTransactionclient. SincePgTransactionholds a singlepg Client(not a Pool), concurrentclient.query()calls on it trigger the deprecation.This will become a hard error in
pg@9.0.Severity
🔹 Minor: Unexpected behavior, but does not block development
Reproduction
An update with multiple include relations triggers it reliably (see below).
Notes:
pg.Poolwithmax > 1toPrismaPgdoes not resolve itfindUniquewith a similarincludeshape — appears specific to write operations that open an implicit transaction and then fetch relations on the same connectionExpected vs. Actual Behavior
Expected: - Shouldn't log a warning (will break in next
pgmajor version)Actual Behavior: - Shows a warning (see below)
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
Warning occurs since
pg8.20.0 (via Prisma 7.5), but behavior is unchanged on Prisma's side.Workaround
Downgrade to
pgto8.18Prisma Schema & Queries
Prisma Config
Logs & Debug Info
Environment & Setup
Also happens in prod on Vercel with Node 24
Prisma Version