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.

Prepared statements maximum bindings

See original GitHub issue

I am trying to do some big bulk inserts to Postgres via node-postgres When the bindings array exceeds 65536 values then passes to postgres the rest of values and when the query it runs I take the error

[error: bind message supplies 4 parameters, but prepared statement "" requires 65540]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
phireskycommented, Aug 13, 2017

@brianc It would still be useful if this would somehow throw a different error.

As it stands, for a parameterized query with X parameters you just get the error [bind message supplies X modulo 65536 parameters, but prepared statement “” requires X] which is very unhelpful for diagnosing the cause for the problem.

Also the limit of 34464 parameters is wrong, at least for postgresql 9.6.3 I can do a single insert with 65535 parameters without problems.

5reactions
brianccommented, Jul 24, 2016

@konhondros Postgres itself doesn’t support more than 34464 parameters for a bound statement. You’ll need to break up your bulk insert into multiple statements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostgreSQL node.js prepared statements maximum bindings
I am trying to do some big bulk inserts to Postgres via node-postgres When the bindings array exceeds 65536 values ...
Read more >
Binding Values To Prepared Statements - SQLite
The leftmost SQL parameter has an index of 1. When the same named SQL parameter is used more than once, second and subsequent...
Read more >
Documentation: 15: PREPARE - PostgreSQL
Prepared statements potentially have the largest performance advantage when a single session is being used to execute a large number of similar statements....
Read more >
Using parameterized queries - Amazon Athena
The maximum number of prepared statements in a workgroup is 1000. SQL statements. You can use the PREPARE , EXECUTE and DEALLOCATE PREPARE...
Read more >
MySQL 8.0 Reference Manual :: 13.5 Prepared Statements
SQL syntax for prepared statements is based on three SQL statements: ... The following examples show two equivalent ways of preparing a statement...
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