Skip to content

Error: prepared statement "XXX" already exists

当你尝试使用 PgBouncer 连接数据库时会出现这个错误。PgBouncer 不支持预处理语句。如果你正在使用预处理语句,你需要使用直接连接——端口 5432。

🌐 This error occurs when you are trying to connect to the database using PgBouncer. PgBouncer does not support prepared statements. If you have prepared statements in use, you will need to use direct connections - port 5432.

在查询字符串里有一个特殊参数,用于让 Prisma 与 PgBouncer 一起工作
https://prisma.nodejs.cn/guides/performance-and-optimization/connection-management/configure-pg-bouncer

🌐 There is a special parameter in the query string for Prisma to work with PgBouncer https://prisma.nodejs.cn/guides/performance-and-optimization/connection-management/configure-pg-bouncer