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

Closed
tmoertel opened this Issue Feb 7, 2011 · 1 comment

Comments

Projects
None yet
2 participants
@tmoertel

tmoertel commented Feb 7, 2011

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: http://www.postgresql.org/docs/8.4/interactive/protocol-flow.html)

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.

Commit: https://github.com/tmoertel/epgsql/commits/extended_query_limbo

@wg

This comment has been minimized.

Show comment Hide comment
@wg

wg Feb 9, 2011

Owner

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.

Owner

wg commented Feb 9, 2011

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.

Gustav-Simonsson pushed a commit to Gustav-Simonsson/epgsql that referenced this issue Jun 5, 2014

Merge pull request #4 from bullno1/array-type-name
Change array types naming convention from typearray to {array, type}

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment