Skip to content

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

Closed

Description

@emerleite

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
  }
}

Activity

  1. morpig commented on Oct 14, 2024

    @morpig

    prepare: false in postgres.js config

  2. emerleite commented on Oct 15, 2024

    @emerleite
    Author

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

  3. added a commit that references this issue on Oct 29, 2026
    06cf284
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions