Skip to content

Can't use prepared statements if a unique comment prepended to the query every time #2735

@KristjanTammekivi

Description

@KristjanTammekivi

We prepend a comment ID'ing the request that caused the db query for easier tracking. I wanted to add name parameter to one query that has a long planning time and ran into an issue where this error is triggered every time
https://github.com/brianc/node-postgres/blob/master/packages/pg/lib/query.js#L149

if (this.text && previous && this.text !== previous) {
  return new Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`)
}

Can we add a way to bypass this check (or strip out leading comments in the check)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions