-
Notifications
You must be signed in to change notification settings - Fork 38
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
v3 Regression: Multiple commands in the same execute
#328
Comments
This is coming from the postgresql server, and apparently it is coming from the extended query protocol's prepare phase. I don't really know how this was implemented in v2, it had a non-trivial complexity around queries that I never ventured into. Maybe it converted it to simple query protocol - I am just guessing here. In v3 we are doing mostly the minimum over the query protocols, in this case the extended query protocol (which is usually more efficient). If the server rejects the queries, my best guess is that you rewrite them into:
/cc @simolus3 for further comments |
Yeah, v2 essentially inlined the variables into the SQL string. If you want to do that yourself, you can set
This is perhaps something we should investigate further. At the moment, running a prepared statement essentially locks the connection until we get a This will complicate the state machine in this package a bit, but I think statement responses are always coming back in-order, so we could keep a queue of outstanding statements and issue all requests at once without waiting for responses. That would reduce the overall latency when batching statements. |
@simolus3 That's interesting, I didn't know it was binding the values as literals. Feel free to keep it open with a different title or close. |
Hello!
I was in the process of migrating a project using
postgres
v2. One thing we are doing in this project to improve the performance of batch uploads to Postgres is to run multiple INSERT statements in the sameexecute
and it has been working great for us.The problem we are seeing is that in v3 it throws with an error:
Severity.error 42601: cannot insert multiple commands into a prepared statement
Are we missing some special configuration to support this?
Sample code:
Version 2.x
Version 3.x
The text was updated successfully, but these errors were encountered: