Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


[PATCH] Allow for recovery after errors in extended queries #4

tmoertel opened this Issue · 1 comment

2 participants


Currently, epgsql will not allow the user to request a sync while the connection is in the "executing" state. When an error occurs in this state, then, the connection becomes wedged because the server requires a sync request to continue:

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. (Source:

The following commit creates a new "awaiting_sync" state and modifies the connection's state machine to transition into this state when an error is encountered in the "executing" state. In this new state, the user can request a sync but nothing else. Attempts to make other requests result in awaiting_sync errors, alerting the user to the server's expectations.


wg commented

Thanks Tom! I just pushed a slightly different fix that puts the connection in an 'aborted' state and returns {error, sync_required}, along with a test case for this issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.