Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Sync calls to extended query execution
This follows the protocol flow described in http://www.postgresql.org/docs/9.1/static/protocol-flow.html "At completion of each series of extended-query messages, the frontend should issue a Sync message."
- Loading branch information
7b0e011
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not every Execute requires Sync, you can send several Binds/Execute and then one Sync.
from the linked documentation
"The purpose of Sync is to provide a resynchronization point for error recovery. When an error is detected while processing any extended-query message, the backend issues ErrorResponse, then reads and discards messages until a Sync is reached, then issues ReadyForQuery and returns to normal message processing."
7b0e011
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reading and commenting. Rereading the docs again I see where I got confused. A very common use for us is to bind and execute a single query. I think I will take a look at extending the pgsql:equery path to support such single query execution, but with reuse of a prepared query.
7b0e011
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking about making something similar in my asynchronous fork. There is execute_batch function (https://github.com/mabrek/epgsql/blob/async/README#L204) that sends one or more Bind/Execute and one Sync.