Skip to content

Answer COPY TO with RETURN_FILES as the count and the list of files written - #2998

Merged
tamnd merged 1 commit into
mainfrom
d5-return-files
Oct 10, 2026
Merged

tamnd merged 1 commit into
mainfrom
d5-return-files

Conversation

@tamnd

@tamnd tamnd commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Part of #1446.

COPY ... TO now takes RETURN_FILES. When it is on, the copy answers a row with Count as a BIGINT and Files as a VARCHAR[] list of every file it wrote, in the order it wrote them, so a partitioned or rotating copy lists each file. A copy with no rows still lists its one empty file, and with WRITE_EMPTY_FILE false the list is empty.

The option value is cast to BOOLEAN the way the pin reads it, so RETURN_FILES 1 is on, RETURN_FILES false gives the plain changed count, and RETURN_FILES 'x' is refused with the pin's Invalid Input message. Only an option that is on counts as set, and setting both RETURN_FILES and RETURN_STATS is refused with the pin's Binder message. RETURN_STATS on a CSV or JSON copy is refused as not implemented, and the message names the "csv" format for JSON too, as the pin's does.

The writers in export.rs now hand back the files they wrote, so the count and the list come from the same place. Everything here was checked against v2.0.0-dev84237.

@tamnd tamnd added kind/compat A gap against DuckDB, on any of the six surfaces. area/duckdb-compat The DuckDB compatibility surfaces. labels Oct 10, 2026
@tamnd
tamnd merged commit f8c5575 into main Oct 10, 2026
1 check failed
@tamnd
tamnd deleted the d5-return-files branch October 10, 2026 04:00
@tamnd tamnd mentioned this pull request Oct 10, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/duckdb-compat The DuckDB compatibility surfaces. kind/compat A gap against DuckDB, on any of the six surfaces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant