Merged
Conversation
Implement the server-driven COPY OUT protocol, completing COPY support alongside the existing COPY IN. The server pushes data via CopyData messages after a COPY ... TO STDOUT query, which the new CopyOutReceiver interface delivers through pg_copy_data/pg_copy_complete/pg_copy_failed callbacks. The implementation follows the same state machine pattern as COPY IN: _QueuedCopyOut queued item, _CopyOutInFlight query state, three new backend message types (CopyOutResponse, CopyData, CopyDone) parsed and routed through the existing _ResponseParser/_ResponseMessageParser pipeline, and full shutdown drain support to prevent double-notification.
1f8278b to
0a0ec6c
Compare
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.
Implements the server-driven COPY OUT protocol (COPY ... TO STDOUT), completing COPY support alongside the existing COPY IN.
New public API:
CopyOutReceiverinterface withpg_copy_data,pg_copy_complete,pg_copy_failedcallbacksSession.copy_out(sql, receiver)behaviorThe server drives the flow — after the COPY query, data arrives via
pg_copy_datacallbacks, andpg_copy_completefires when all data has been delivered.Includes 9 new tests (3 parser, 4 mock server, 2 integration), a copy-out example, and documentation updates.