Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: bind message has 9914 parameter formats but 0 parameters

I'm using PostgresSQL and I'm trying to remove all the data that I have in the columns (my entity is composed of id and name), but when I run the code, an error message appears.

This is the code (I'm using NestJs and 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);
  }
}

However, I get the following error on the console:

ERROR: bind message has 9914 parameter formats but 0 parameters

There are 115900 rows in this table, is that the reason for this behavior? What should I do?

like image 759
Ian Bergia Avatar asked Nov 21 '25 23:11

Ian Bergia


1 Answers

Just in case you were still looking for an answer: I ran into the same issue using Nestjs and TypeORM. There is a limit to the amount of placeholders in the query. You can specify {chunk: <chunkSize>}

I found that here

So f.e.:

await this.linioBrandRepo.remove(existingBrands, {chunk: 100});
like image 179
Chai Avatar answered Nov 25 '25 00:11

Chai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!