I'm looping over some array items and perform some DB tasks. It's basic Select and Inserts.
Somehow, I receive prepared statment already exists error.
I saw other issues people mentioning something related with pg_bouncer.
Any tips?
async function xpto(items) {
const sql = postgres(env.DB_SUPABASE.connectionString)
for (const item of items) {
await doStuff(item, sql);
}
}
async function doStuff(item, sql) {
//Sometimes this and other thows `prepared statment already exists` error
const checkSomething = await sql`SELECT * FROM table WHERE a_column = ${item.value};`
if (checkSomething.a_column == 'something') {
//Finish Work
}
}
I'm looping over some array items and perform some DB tasks. It's basic Select and Inserts.
Somehow, I receive
prepared statment already exists
error.I saw other issues people mentioning something related with pg_bouncer.
Any tips?