Compose a valid COPY FROM or COPY TO statement without hunting through the docs — pick format, delimiter, null token, header handling, quoting, encoding, and per-column overrides. See both the server-side COPY (runs as the superuser, path is on the server) and the equivalent psql\copy meta-command that streams through your local client.
Basics
Format & delimiters
Per-column options
Generated COPY
—
psql \copy equivalent runs client-side, no superuser needed
—
Cheat sheet
COPY FROM requires that the server process can read the path; use \copy to stream through your client instead.
text format uses tab as the default delimiter and \N as the default NULL representation; csv uses comma and empty-string.
FREEZE only works when the target table was created or truncated in the same transaction — it marks rows as frozen so VACUUM won't rewrite them.
ON_ERROR ignore (PostgreSQL 17+) discards bad rows and continues, otherwise the whole load rolls back on the first parse error.
ESCAPE defaults to the same character as QUOTE; only override if your data doubles a different character to escape quotes.
The output columns of a COPY (SELECT …) TO come from the query, not from a table — you don't (and can't) list columns on that form.