postgresql_16:7.1.53.7 Compatibility
PostgreSQL 16 > Reference > SQL Commands > COPY > Compatibility
There is no COPY statement in the SQL standard.
The following syntax was used before PostgreSQL version 9.0 and is still supported: COPY *table_name* [ ( *column_name* [, ...] ) ] FROM { '*filename*' | STDIN } [ [ WITH ] [ BINARY ] [ DELIMITER [ AS ] '*delimiter_character*' ] [ NULL [ AS ] '*null_string*' ] [ CSV [ HEADER ] [ QUOTE [ AS ] '*quote_character*' ] [ ESCAPE [ AS ] '*escape_character*' ] [ FORCE NOT NULL *column_name* [, ...] ] ] ] COPY { *table_name* [ ( *column_name* [, ...] ) ] | ( *query* ) } TO { '*filename*' | STDOUT } [ [ WITH ] [ BINARY ] [ DELIMITER [ AS ] '*delimiter_character*' ] [ NULL [ AS ] '*null_string*' ] [ CSV [ HEADER ] [ QUOTE [ AS ] '*quote_character*' ] [ ESCAPE [ AS ] '*escape_character*' ] [ FORCE QUOTE { *column_name* [, ...] | * } ] ] ] Note that in this syntax, BINARY and CSV are treated as independent keywords, not as arguments of a FORMAT option.
The following syntax was used before PostgreSQL version 7.3 and is still supported: COPY [ BINARY ] *table_name* FROM { '*filename*' | STDIN } [ [USING] DELIMITERS '*delimiter_character*' ] [ WITH NULL AS '*null_string*' ] COPY [ BINARY ] *table_name* TO { '*filename*' | STDOUT } [ [USING] DELIMITERS '*delimiter_character*' ] [ WITH NULL AS '*null_string*' ]