question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connection flag to disable prepared statements

See original GitHub issue

As far as I see in the source code, it is not possible to pass a flag like prepared_statements: false to pg client config. Is it possible to add this feature?

Thank you.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
charmandercommented, Jul 23, 2019

Your advise is one option but otherwise it does not look hard to modify requiresPreparation in /lib/query.js to check for a parameter to enable/disable prepared statements.

And throw an error if it does? That’s extremely niche. You can accomplish this by monkeypatching/via a wrapper if it helps you refactor for testing.

0reactions
lastmjscommented, Sep 4, 2020

You can accomplish this by monkeypatching/via a wrapper if it helps you refactor for testing.

@charmander Can you give me some detail on how I would accomplish this kind of monkeypatching? I’m trying to get node-postgres prepared statements to work with transaction pooling on RDS, and it’s proving extremely difficult (all prepared statements are session pinned). Getting rid of prepared statements would be a solution to this, but I’m not sure how to go about it. I am using Knex as well as node-postgres directly, so somehow being able to intercept very query to apply this would be nice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Option to turn off Prepared Statements - IBM
The config parameter is a Boolean flag that indicates whether the JDBC connector should use PreparedStatements. If this is set the connector will...
Read more >
How can I disable prepared statements for using pgbouncer ...
I want to use pgbouncer in transaction pool mode. To do this you cannot use prepared statements. I set the JDBC PSQL connection...
Read more >
Hibernate prepareConnection/preparedStatement issues
What happens if we switch the prepareConnection flag to false ? I tried to find such flag in Hibernate configuration but couldn't find...
Read more >
PgBouncer and prepared statements - Developer's life
In our system, we use connection pooler called PgBouncer as a proxy to PostgreSQL server. PgBouncer has two main modes. Session pooling mode....
Read more >
MySQL 8.0 Reference Manual :: 13.5 Prepared Statements
To write C programs that use the CALL SQL statement to execute stored procedures that contain prepared statements, the CLIENT_MULTI_RESULTS flag must be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found