PostgreSQL · Command
COPY
COPY moves data between PostgreSQL tables or query results and files, programs, or the client connection. FROM imports rows; TO exports rows.
Last updated
Syntax
COPY table_name [ ( column_name [, ...] ) ] FROM { 'filename' | PROGRAM 'command' | STDIN } [ [ WITH ] ( option [, ...] ) ] [ WHERE condition ]
COPY { table_name [ ( column_name [, ...] ) ] | ( query ) } TO { 'filename' | PROGRAM 'command' | STDOUT } [ [ WITH ] ( option [, ...] ) ]In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
pg_stat_progress_copy\copyFORMATON_ERRORREJECT_LIMITPQputCopyDataPQgetCopyDataSTDIN