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?
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});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With