Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cloudflare Hyperdrive] PostgresError: prepared statement "o0gtsdfu434" already exists #960

Open
emerleite opened this issue Oct 13, 2024 · 2 comments

Comments

@emerleite
Copy link

emerleite commented Oct 13, 2024

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
  }
}
@morpig
Copy link

morpig commented Oct 14, 2024

prepare: false in postgres.js config

@emerleite
Copy link
Author

@morpig thanks. But how do I manual create it when it needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants