【问题标题】:ERROR: bind message has 9914 parameter formats but 0 parameters错误:绑定消息有 9914 个参数格式但 0 个参数
【发布时间】:2021-06-28 13:21:47
【问题描述】:

我正在使用 PostgresSQL,我正在尝试删除列中的所有数据(我的实体由 Id an name 组成),但是当我运行代码时出现错误消息:

这是代码(我使用的是 NestJs,TypeOrm):

    @Injectable()
export class ClearLinioBrands {
  constructor(
    @InjectRepository(LinioBrand)
    private linioBrandRepo: Repository<LinioBrand>,
  ) {}
  async execute(): Promise<void> {
    const existingBrands = await this.linioBrandRepo.find();
    await this.linioBrandRepo.remove(existingBrands);
  }
}

但是,控制台向我抛出了这个错误:

'错误:绑定消息有9914个参数格式但0个参数'

此实体中的总行数为 115900 行,这是此行为的原因吗?我该怎么办?

谢谢

【问题讨论】:

    标签: postgresql pagination nestjs typeorm


    【解决方案1】:

    以防万一您仍在寻找答案: 我使用 Nestjs 和 TypeORM 遇到了同样的问题。查询中的占位符数量有限制。你可以指定{chunk: &lt;chunkSize&gt;}

    我发现here

    所以说:

    await this.linioBrandRepo.remove(existingBrands, {chunk: 100});
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-23
      • 1970-01-01
      • 2016-07-08
      • 2020-12-12
      • 1970-01-01
      • 2012-03-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多