postgresql Prisma Postres错误准备语句\“s0\”已存在

zfycwa2u  于 2023-02-22  发布在  PostgreSQL
关注(0)|答案(1)|浏览(232)

我有一个Next.js项目,我使用Prisma从Postgresql读取。
我的代码如下:

const rows = await prisma.receipts.findMany({
      where: {
        action_receipts: {
          // https://www.prisma.io/docs/concepts/components/prisma-client/filtering-and-sorting#filter-on-relations
          signer_account_id: {
            equals: accountName,
          },
        },
      },
      orderBy: {
        included_in_block_timestamp: 'desc',
      },
      take: 2, 
    });

我经常得到错误,如:

error: PrismaClientUnknownRequestError: 
  Invalid `prisma.receipts.findMany()` invocation:
  
  
    Error occurred during query execution:
  ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("42P05"), message: "prepared statement \"s0\" already exists", detail: None, hint: None, position: None, where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("prepare.c"), line: Some(480), routine: Some("StorePreparedStatement") }) }) })

(有时不是“s0”,而是说其他的东西,比如“s8”。)
这意味着什么?我该如何避免?
如果我停止本地服务器并等待一分钟,然后通过yarn dev重新启动,然后再次尝试Prisma查询,问题似乎通常会消失,但我忘记了根本原因,而我想找出并解决这个问题。

brgchamk

brgchamk1#

我在superbase上重新启动了这个项目,它起作用了。
转到supbase项目文件上的设置,然后单击restart project

相关问题