postgres_fdw: Use COPY to speed up batch inserts

First seen: 2025-10-15 15:02:01+00:00 · Messages: 34 · Participants: 8

Latest Update

2026-06-01 · claude-opus-4-6

Incremental Update: v13 Patchset — Switch Back to TEXT Format with Refactored Escaping

Key Change: CSV → TEXT format reversal, with code deduplication

Matheus posted a new patchset (v13) that reverses the previous decision to use CSV format and returns to TEXT format for the COPY stream. The critical difference from earlier TEXT attempts is that the escaping logic is no longer duplicated — it's extracted from the core COPY TO code path into a reusable function.

0001 — Refactor CopyAttributeOutText into a reusable utility:

0002 — Main feature patch using TEXT format with shared escaping:

Why This Matters

The FORMAT choice (TEXT vs CSV vs BINARY) was a significant design decision in earlier rounds. CSV had "won" because it was deemed simpler to implement correctly. This revision argues that with the escaping logic properly factored out of core into a shared function, TEXT format is equally correct and avoids the overhead/complexity of CSV quoting. It also means postgres_fdw's escaping stays in sync with core COPY automatically — if core's CopyAttributeOutText logic changes, the shared function changes for both callers.

No Other Substantive Technical Discussion

The second message is simply a cross-reference pointing a reviewer to the new patchset. No new reviewers, no new technical arguments, and no benchmark data accompanies this revision.