Repository navigation
Conversation
A COPY the server refuses before copy-in mode (missing table, permission, a statement that is not COPY FROM STDIN) answered that Sync with ReadyForQuery, and the Sync sent with CopyFail got a second one, which left the connection out of step. The Sync sent with CopyDone or CopyFail now ends the exchange in every case.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
copy_insends Bind, Execute, Sync, and later a second Sync with CopyDone or CopyFail. In copy-in mode the server ignores the first Sync. When it refuses the statement before copy-in mode (missing table, permission denied, a cancel while it waits on a lock, a statement that is notCOPY ... FROM STDIN), it answers that Sync with ReadyForQuery, and the Sync sent with CopyFail gets a second one. The stray ReadyForQuery goes to the next request, or fails the connection with an unexpected message when none is queued.The fix sends Flush in place of the first Sync, so the Sync sent with CopyDone or CopyFail ends the exchange in every case. Flush still makes the server send BindComplete, CopyInResponse or the error right away.
Tests, against the docker-compose server:
copy_in_statement_error: COPY into a missing table, then a query on the same client.copy_in_not_a_copy:SELECT 1throughcopy_in, then a query.copy_in_dropped_before_copy_mode: thecopy_infuture is dropped while the COPY waits on a lock. The CopyFail still has to go out, since the server enters copy-in mode once the lock is free.The first two fail without the fix.
Fixes #789. Same change as #1337, plus the server tests. #1398 skips the CopyFail when no CopyInResponse arrived, which fails
copy_in_dropped_before_copy_mode.