PostgreSQL Backup and Restore Cheat Sheet/COPY FREEZE into fresh table

Load immutable initial data into a newly created or truncated table.

Section: COPY Import and Export

COPY FREEZE into fresh table

sql
sql
COPY staging_import FROM STDIN WITH (FORMAT csv, HEADER true, FREEZE true);
Explanation

Useful for bulk-load workflows with certain constraints.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing COPY Import and Export
Server-side COPY to CSV
Write a table to a server-side file.
OpenIn sheetsqlsame section
Server-side COPY from CSV
Load rows from a server-side CSV file.
OpenIn sheetsqlsame section
Client-side \copy export
Export via the client machine rather than the database server.
OpenIn sheetsqlsame section
Client-side \copy import
Import CSV from the client machine.
OpenIn sheetsqlsame section
COPY query to program
Stream exported data to a server-side program.
OpenIn sheetsqlsame section
Custom format dump
Create a compressed custom-format backup archive.