Skip to content

Add COPY TO STDOUT support#122

Merged
SeanTAllen merged 1 commit intomainfrom
add-copy-out
Feb 14, 2026
Merged

Add COPY TO STDOUT support#122
SeanTAllen merged 1 commit intomainfrom
add-copy-out

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

Implements the server-driven COPY OUT protocol (COPY ... TO STDOUT), completing COPY support alongside the existing COPY IN.

New public API:

  • CopyOutReceiver interface with pg_copy_data, pg_copy_complete, pg_copy_failed callbacks
  • Session.copy_out(sql, receiver) behavior

The server drives the flow — after the COPY query, data arrives via pg_copy_data callbacks, and pg_copy_complete fires when all data has been delivered.

Includes 9 new tests (3 parser, 4 mock server, 2 integration), a copy-out example, and documentation updates.

@SeanTAllen SeanTAllen added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Feb 14, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Feb 14, 2026
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.
@SeanTAllen SeanTAllen merged commit 47d0518 into main Feb 14, 2026
8 checks passed
@SeanTAllen SeanTAllen deleted the add-copy-out branch February 14, 2026 14:25
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Feb 14, 2026
github-actions bot pushed a commit that referenced this pull request Feb 14, 2026
github-actions bot pushed a commit that referenced this pull request Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - added Automatically add "Added" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants