Global and Column-Specific Options

You can specify some COPY options globally, for the entire COPY statement, or limit their scope to a column. For example, in the following COPY statement, the first column is delimited by '|' but the others are delimited by commas.

=> COPY employees(id DELIMITER '|', name, department) FROM ... DELIMITER ',';

You could specify a different default for null inputs for one column:

=> COPY employees(id, name, department NULL 'General Admin') FROM ... ;

Alternatively, you can use the COLUMN OPTION parameter to specify column-specific parameters instead of enumerating the columns:

=> COPY employees COLUMN OPTION (department NULL 'General Admin') FROM ... ;

Where both global and column-specific values are provided for the same parameter, the column-specific value governs those columns and the global one governs others.

All parameters can be used globally. The description of each parameter indicates whether it can be restricted to specific columns.