1COPY(7) PostgreSQL 12.2 Documentation COPY(7)
2
3
4
6 COPY - copy data between a file and a table
7
9 COPY table_name [ ( column_name [, ...] ) ]
10 FROM { 'filename' | PROGRAM 'command' | STDIN }
11 [ [ WITH ] ( option [, ...] ) ]
12 [ WHERE condition ]
13
14 COPY { table_name [ ( column_name [, ...] ) ] | ( query ) }
15 TO { 'filename' | PROGRAM 'command' | STDOUT }
16 [ [ WITH ] ( option [, ...] ) ]
17
18 where option can be one of:
19
20 FORMAT format_name
21 FREEZE [ boolean ]
22 DELIMITER 'delimiter_character'
23 NULL 'null_string'
24 HEADER [ boolean ]
25 QUOTE 'quote_character'
26 ESCAPE 'escape_character'
27 FORCE_QUOTE { ( column_name [, ...] ) | * }
28 FORCE_NOT_NULL ( column_name [, ...] )
29 FORCE_NULL ( column_name [, ...] )
30 ENCODING 'encoding_name'
31
33 COPY moves data between PostgreSQL tables and standard file-system
34 files. COPY TO copies the contents of a table to a file, while COPY
35 FROM copies data from a file to a table (appending the data to whatever
36 is in the table already). COPY TO can also copy the results of a
37 SELECT query.
38
39 If a column list is specified, COPY TO copies only the data in the
40 specified columns to the file. For COPY FROM, each field in the file is
41 inserted, in order, into the specified column. Table columns not
42 specified in the COPY FROM column list will receive their default
43 values.
44
45 COPY with a file name instructs the PostgreSQL server to directly read
46 from or write to a file. The file must be accessible by the PostgreSQL
47 user (the user ID the server runs as) and the name must be specified
48 from the viewpoint of the server. When PROGRAM is specified, the server
49 executes the given command and reads from the standard output of the
50 program, or writes to the standard input of the program. The command
51 must be specified from the viewpoint of the server, and be executable
52 by the PostgreSQL user. When STDIN or STDOUT is specified, data is
53 transmitted via the connection between the client and the server.
54
56 table_name
57 The name (optionally schema-qualified) of an existing table.
58
59 column_name
60 An optional list of columns to be copied. If no column list is
61 specified, all columns of the table except generated columns will
62 be copied.
63
64 query
65 A SELECT(7), VALUES(7), INSERT(7), UPDATE(7) or DELETE(7) command
66 whose results are to be copied. Note that parentheses are required
67 around the query.
68
69 For INSERT, UPDATE and DELETE queries a RETURNING clause must be
70 provided, and the target relation must not have a conditional rule,
71 nor an ALSO rule, nor an INSTEAD rule that expands to multiple
72 statements.
73
74 filename
75 The path name of the input or output file. An input file name can
76 be an absolute or relative path, but an output file name must be an
77 absolute path. Windows users might need to use an E'' string and
78 double any backslashes used in the path name.
79
80 PROGRAM
81 A command to execute. In COPY FROM, the input is read from standard
82 output of the command, and in COPY TO, the output is written to the
83 standard input of the command.
84
85 Note that the command is invoked by the shell, so if you need to
86 pass any arguments to shell command that come from an untrusted
87 source, you must be careful to strip or escape any special
88 characters that might have a special meaning for the shell. For
89 security reasons, it is best to use a fixed command string, or at
90 least avoid passing any user input in it.
91
92 STDIN
93 Specifies that input comes from the client application.
94
95 STDOUT
96 Specifies that output goes to the client application.
97
98 boolean
99 Specifies whether the selected option should be turned on or off.
100 You can write TRUE, ON, or 1 to enable the option, and FALSE, OFF,
101 or 0 to disable it. The boolean value can also be omitted, in which
102 case TRUE is assumed.
103
104 FORMAT
105 Selects the data format to be read or written: text, csv (Comma
106 Separated Values), or binary. The default is text.
107
108 FREEZE
109 Requests copying the data with rows already frozen, just as they
110 would be after running the VACUUM FREEZE command. This is intended
111 as a performance option for initial data loading. Rows will be
112 frozen only if the table being loaded has been created or truncated
113 in the current subtransaction, there are no cursors open and there
114 are no older snapshots held by this transaction. It is currently
115 not possible to perform a COPY FREEZE on a partitioned table.
116
117 Note that all other sessions will immediately be able to see the
118 data once it has been successfully loaded. This violates the normal
119 rules of MVCC visibility and users specifying should be aware of
120 the potential problems this might cause.
121
122 DELIMITER
123 Specifies the character that separates columns within each row
124 (line) of the file. The default is a tab character in text format,
125 a comma in CSV format. This must be a single one-byte character.
126 This option is not allowed when using binary format.
127
128 NULL
129 Specifies the string that represents a null value. The default is
130 \N (backslash-N) in text format, and an unquoted empty string in
131 CSV format. You might prefer an empty string even in text format
132 for cases where you don't want to distinguish nulls from empty
133 strings. This option is not allowed when using binary format.
134
135 Note
136 When using COPY FROM, any data item that matches this string
137 will be stored as a null value, so you should make sure that
138 you use the same string as you used with COPY TO.
139
140 HEADER
141 Specifies that the file contains a header line with the names of
142 each column in the file. On output, the first line contains the
143 column names from the table, and on input, the first line is
144 ignored. This option is allowed only when using CSV format.
145
146 QUOTE
147 Specifies the quoting character to be used when a data value is
148 quoted. The default is double-quote. This must be a single one-byte
149 character. This option is allowed only when using CSV format.
150
151 ESCAPE
152 Specifies the character that should appear before a data character
153 that matches the QUOTE value. The default is the same as the QUOTE
154 value (so that the quoting character is doubled if it appears in
155 the data). This must be a single one-byte character. This option is
156 allowed only when using CSV format.
157
158 FORCE_QUOTE
159 Forces quoting to be used for all non-NULL values in each specified
160 column. NULL output is never quoted. If * is specified, non-NULL
161 values will be quoted in all columns. This option is allowed only
162 in COPY TO, and only when using CSV format.
163
164 FORCE_NOT_NULL
165 Do not match the specified columns' values against the null string.
166 In the default case where the null string is empty, this means that
167 empty values will be read as zero-length strings rather than nulls,
168 even when they are not quoted. This option is allowed only in COPY
169 FROM, and only when using CSV format.
170
171 FORCE_NULL
172 Match the specified columns' values against the null string, even
173 if it has been quoted, and if a match is found set the value to
174 NULL. In the default case where the null string is empty, this
175 converts a quoted empty string into NULL. This option is allowed
176 only in COPY FROM, and only when using CSV format.
177
178 ENCODING
179 Specifies that the file is encoded in the encoding_name. If this
180 option is omitted, the current client encoding is used. See the
181 Notes below for more details.
182
183 WHERE
184 The optional WHERE clause has the general form
185
186 WHERE condition
187
188 where condition is any expression that evaluates to a result of
189 type boolean. Any row that does not satisfy this condition will not
190 be inserted to the table. A row satisfies the condition if it
191 returns true when the actual row values are substituted for any
192 variable references.
193
194 Currently, subqueries are not allowed in WHERE expressions, and the
195 evaluation does not see any changes made by the COPY itself (this
196 matters when the expression contains calls to VOLATILE functions).
197
199 On successful completion, a COPY command returns a command tag of the
200 form
201
202 COPY count
203
204 The count is the number of rows copied.
205
206 Note
207 psql will print this command tag only if the command was not COPY
208 ... TO STDOUT, or the equivalent psql meta-command \copy ... to
209 stdout. This is to prevent confusing the command tag with the data
210 that was just printed.
211
213 COPY TO can only be used with plain tables, not with views. However,
214 you can write COPY (SELECT * FROM viewname) TO ... to copy the current
215 contents of a view.
216
217 COPY FROM can be used with plain, foreign, or partitioned tables or
218 with views that have INSTEAD OF INSERT triggers.
219
220 COPY only deals with the specific table named; it does not copy data to
221 or from child tables. Thus for example COPY table TO shows the same
222 data as SELECT * FROM ONLY table. But COPY (SELECT * FROM table) TO ...
223 can be used to dump all of the data in an inheritance hierarchy.
224
225 You must have select privilege on the table whose values are read by
226 COPY TO, and insert privilege on the table into which values are
227 inserted by COPY FROM. It is sufficient to have column privileges on
228 the column(s) listed in the command.
229
230 If row-level security is enabled for the table, the relevant SELECT
231 policies will apply to COPY table TO statements. Currently, COPY FROM
232 is not supported for tables with row-level security. Use equivalent
233 INSERT statements instead.
234
235 Files named in a COPY command are read or written directly by the
236 server, not by the client application. Therefore, they must reside on
237 or be accessible to the database server machine, not the client. They
238 must be accessible to and readable or writable by the PostgreSQL user
239 (the user ID the server runs as), not the client. Similarly, the
240 command specified with PROGRAM is executed directly by the server, not
241 by the client application, must be executable by the PostgreSQL user.
242 COPY naming a file or command is only allowed to database superusers or
243 users who are granted one of the default roles pg_read_server_files,
244 pg_write_server_files, or pg_execute_server_program, since it allows
245 reading or writing any file or running a program that the server has
246 privileges to access.
247
248 Do not confuse COPY with the psql instruction \copy. \copy invokes
249 COPY FROM STDIN or COPY TO STDOUT, and then fetches/stores the data in
250 a file accessible to the psql client. Thus, file accessibility and
251 access rights depend on the client rather than the server when \copy is
252 used.
253
254 It is recommended that the file name used in COPY always be specified
255 as an absolute path. This is enforced by the server in the case of COPY
256 TO, but for COPY FROM you do have the option of reading from a file
257 specified by a relative path. The path will be interpreted relative to
258 the working directory of the server process (normally the cluster's
259 data directory), not the client's working directory.
260
261 Executing a command with PROGRAM might be restricted by the operating
262 system's access control mechanisms, such as SELinux.
263
264 COPY FROM will invoke any triggers and check constraints on the
265 destination table. However, it will not invoke rules.
266
267 For identity columns, the COPY FROM command will always write the
268 column values provided in the input data, like the INSERT option
269 OVERRIDING SYSTEM VALUE.
270
271 COPY input and output is affected by DateStyle. To ensure portability
272 to other PostgreSQL installations that might use non-default DateStyle
273 settings, DateStyle should be set to ISO before using COPY TO. It is
274 also a good idea to avoid dumping data with IntervalStyle set to
275 sql_standard, because negative interval values might be misinterpreted
276 by a server that has a different setting for IntervalStyle.
277
278 Input data is interpreted according to ENCODING option or the current
279 client encoding, and output data is encoded in ENCODING or the current
280 client encoding, even if the data does not pass through the client but
281 is read from or written to a file directly by the server.
282
283 COPY stops operation at the first error. This should not lead to
284 problems in the event of a COPY TO, but the target table will already
285 have received earlier rows in a COPY FROM. These rows will not be
286 visible or accessible, but they still occupy disk space. This might
287 amount to a considerable amount of wasted disk space if the failure
288 happened well into a large copy operation. You might wish to invoke
289 VACUUM to recover the wasted space.
290
291 FORCE_NULL and FORCE_NOT_NULL can be used simultaneously on the same
292 column. This results in converting quoted null strings to null values
293 and unquoted null strings to empty strings.
294
296 Text Format
297 When the text format is used, the data read or written is a text file
298 with one line per table row. Columns in a row are separated by the
299 delimiter character. The column values themselves are strings generated
300 by the output function, or acceptable to the input function, of each
301 attribute's data type. The specified null string is used in place of
302 columns that are null. COPY FROM will raise an error if any line of
303 the input file contains more or fewer columns than are expected.
304
305 End of data can be represented by a single line containing just
306 backslash-period (\.). An end-of-data marker is not necessary when
307 reading from a file, since the end of file serves perfectly well; it is
308 needed only when copying data to or from client applications using
309 pre-3.0 client protocol.
310
311 Backslash characters (\) can be used in the COPY data to quote data
312 characters that might otherwise be taken as row or column delimiters.
313 In particular, the following characters must be preceded by a backslash
314 if they appear as part of a column value: backslash itself, newline,
315 carriage return, and the current delimiter character.
316
317 The specified null string is sent by COPY TO without adding any
318 backslashes; conversely, COPY FROM matches the input against the null
319 string before removing backslashes. Therefore, a null string such as \N
320 cannot be confused with the actual data value \N (which would be
321 represented as \\N).
322
323 The following special backslash sequences are recognized by COPY FROM:
324
325 ┌─────────┬────────────────────────────┐
326 │Sequence │ Represents │
327 ├─────────┼────────────────────────────┤
328 │\b │ Backspace (ASCII 8) │
329 ├─────────┼────────────────────────────┤
330 │\f │ Form feed (ASCII 12) │
331 ├─────────┼────────────────────────────┤
332 │\n │ Newline (ASCII 10) │
333 ├─────────┼────────────────────────────┤
334 │\r │ Carriage return (ASCII 13) │
335 ├─────────┼────────────────────────────┤
336 │\t │ Tab (ASCII 9) │
337 ├─────────┼────────────────────────────┤
338 │\v │ Vertical tab (ASCII 11) │
339 ├─────────┼────────────────────────────┤
340 │\digits │ Backslash followed by one │
341 │ │ to three octal digits │
342 │ │ specifies │
343 │ │ the character with │
344 │ │ that numeric code │
345 ├─────────┼────────────────────────────┤
346 │\xdigits │ Backslash x followed by │
347 │ │ one or two hex digits │
348 │ │ specifies │
349 │ │ the character with │
350 │ │ that numeric code │
351 └─────────┴────────────────────────────┘
352 Presently, COPY TO will never emit an octal or hex-digits backslash
353 sequence, but it does use the other sequences listed above for those
354 control characters.
355
356 Any other backslashed character that is not mentioned in the above
357 table will be taken to represent itself. However, beware of adding
358 backslashes unnecessarily, since that might accidentally produce a
359 string matching the end-of-data marker (\.) or the null string (\N by
360 default). These strings will be recognized before any other backslash
361 processing is done.
362
363 It is strongly recommended that applications generating COPY data
364 convert data newlines and carriage returns to the \n and \r sequences
365 respectively. At present it is possible to represent a data carriage
366 return by a backslash and carriage return, and to represent a data
367 newline by a backslash and newline. However, these representations
368 might not be accepted in future releases. They are also highly
369 vulnerable to corruption if the COPY file is transferred across
370 different machines (for example, from Unix to Windows or vice versa).
371
372 COPY TO will terminate each row with a Unix-style newline (“\n”).
373 Servers running on Microsoft Windows instead output carriage
374 return/newline (“\r\n”), but only for COPY to a server file; for
375 consistency across platforms, COPY TO STDOUT always sends “\n”
376 regardless of server platform. COPY FROM can handle lines ending with
377 newlines, carriage returns, or carriage return/newlines. To reduce the
378 risk of error due to un-backslashed newlines or carriage returns that
379 were meant as data, COPY FROM will complain if the line endings in the
380 input are not all alike.
381
382 CSV Format
383 This format option is used for importing and exporting the Comma
384 Separated Value (CSV) file format used by many other programs, such as
385 spreadsheets. Instead of the escaping rules used by PostgreSQL's
386 standard text format, it produces and recognizes the common CSV
387 escaping mechanism.
388
389 The values in each record are separated by the DELIMITER character. If
390 the value contains the delimiter character, the QUOTE character, the
391 NULL string, a carriage return, or line feed character, then the whole
392 value is prefixed and suffixed by the QUOTE character, and any
393 occurrence within the value of a QUOTE character or the ESCAPE
394 character is preceded by the escape character. You can also use
395 FORCE_QUOTE to force quotes when outputting non-NULL values in specific
396 columns.
397
398 The CSV format has no standard way to distinguish a NULL value from an
399 empty string. PostgreSQL's COPY handles this by quoting. A NULL is
400 output as the NULL parameter string and is not quoted, while a non-NULL
401 value matching the NULL parameter string is quoted. For example, with
402 the default settings, a NULL is written as an unquoted empty string,
403 while an empty string data value is written with double quotes ("").
404 Reading values follows similar rules. You can use FORCE_NOT_NULL to
405 prevent NULL input comparisons for specific columns. You can also use
406 FORCE_NULL to convert quoted null string data values to NULL.
407
408 Because backslash is not a special character in the CSV format, \., the
409 end-of-data marker, could also appear as a data value. To avoid any
410 misinterpretation, a \. data value appearing as a lone entry on a line
411 is automatically quoted on output, and on input, if quoted, is not
412 interpreted as the end-of-data marker. If you are loading a file
413 created by another application that has a single unquoted column and
414 might have a value of \., you might need to quote that value in the
415 input file.
416
417 Note
418 In CSV format, all characters are significant. A quoted value
419 surrounded by white space, or any characters other than DELIMITER,
420 will include those characters. This can cause errors if you import
421 data from a system that pads CSV lines with white space out to some
422 fixed width. If such a situation arises you might need to
423 preprocess the CSV file to remove the trailing white space, before
424 importing the data into PostgreSQL.
425
426 Note
427 CSV format will both recognize and produce CSV files with quoted
428 values containing embedded carriage returns and line feeds. Thus
429 the files are not strictly one line per table row like text-format
430 files.
431
432 Note
433 Many programs produce strange and occasionally perverse CSV files,
434 so the file format is more a convention than a standard. Thus you
435 might encounter some files that cannot be imported using this
436 mechanism, and COPY might produce files that other programs cannot
437 process.
438
439 Binary Format
440 The binary format option causes all data to be stored/read as binary
441 format rather than as text. It is somewhat faster than the text and CSV
442 formats, but a binary-format file is less portable across machine
443 architectures and PostgreSQL versions. Also, the binary format is very
444 data type specific; for example it will not work to output binary data
445 from a smallint column and read it into an integer column, even though
446 that would work fine in text format.
447
448 The binary file format consists of a file header, zero or more tuples
449 containing the row data, and a file trailer. Headers and data are in
450 network byte order.
451
452 Note
453 PostgreSQL releases before 7.4 used a different binary file format.
454
455 File Header
456 The file header consists of 15 bytes of fixed fields, followed by a
457 variable-length header extension area. The fixed fields are:
458
459 Signature
460 11-byte sequence PGCOPY\n\377\r\n\0 — note that the zero byte
461 is a required part of the signature. (The signature is designed
462 to allow easy identification of files that have been munged by
463 a non-8-bit-clean transfer. This signature will be changed by
464 end-of-line-translation filters, dropped zero bytes, dropped
465 high bits, or parity changes.)
466
467 Flags field
468 32-bit integer bit mask to denote important aspects of the file
469 format. Bits are numbered from 0 (LSB) to 31 (MSB). Note that
470 this field is stored in network byte order (most significant
471 byte first), as are all the integer fields used in the file
472 format. Bits 16-31 are reserved to denote critical file format
473 issues; a reader should abort if it finds an unexpected bit set
474 in this range. Bits 0-15 are reserved to signal
475 backwards-compatible format issues; a reader should simply
476 ignore any unexpected bits set in this range. Currently only
477 one flag bit is defined, and the rest must be zero:
478
479 Bit 16
480 If 1, OIDs are included in the data; if 0, not. Oid system
481 columns are not supported in PostgreSQL anymore, but the
482 format still contains the indicator.
483
484 Header extension area length
485 32-bit integer, length in bytes of remainder of header, not
486 including self. Currently, this is zero, and the first tuple
487 follows immediately. Future changes to the format might allow
488 additional data to be present in the header. A reader should
489 silently skip over any header extension data it does not know
490 what to do with.
491
492 The header extension area is envisioned to contain a sequence of
493 self-identifying chunks. The flags field is not intended to tell
494 readers what is in the extension area. Specific design of header
495 extension contents is left for a later release.
496
497 This design allows for both backwards-compatible header additions
498 (add header extension chunks, or set low-order flag bits) and
499 non-backwards-compatible changes (set high-order flag bits to
500 signal such changes, and add supporting data to the extension area
501 if needed).
502
503 Tuples
504 Each tuple begins with a 16-bit integer count of the number of
505 fields in the tuple. (Presently, all tuples in a table will have
506 the same count, but that might not always be true.) Then, repeated
507 for each field in the tuple, there is a 32-bit length word followed
508 by that many bytes of field data. (The length word does not include
509 itself, and can be zero.) As a special case, -1 indicates a NULL
510 field value. No value bytes follow in the NULL case.
511
512 There is no alignment padding or any other extra data between
513 fields.
514
515 Presently, all data values in a binary-format file are assumed to
516 be in binary format (format code one). It is anticipated that a
517 future extension might add a header field that allows per-column
518 format codes to be specified.
519
520 To determine the appropriate binary format for the actual tuple
521 data you should consult the PostgreSQL source, in particular the
522 *send and *recv functions for each column's data type (typically
523 these functions are found in the src/backend/utils/adt/ directory
524 of the source distribution).
525
526 If OIDs are included in the file, the OID field immediately follows
527 the field-count word. It is a normal field except that it's not
528 included in the field-count. Note that oid system columns are not
529 supported in current versions of PostgreSQL.
530
531 File Trailer
532 The file trailer consists of a 16-bit integer word containing -1.
533 This is easily distinguished from a tuple's field-count word.
534
535 A reader should report an error if a field-count word is neither -1
536 nor the expected number of columns. This provides an extra check
537 against somehow getting out of sync with the data.
538
540 The following example copies a table to the client using the vertical
541 bar (|) as the field delimiter:
542
543 COPY country TO STDOUT (DELIMITER '|');
544
545 To copy data from a file into the country table:
546
547 COPY country FROM '/usr1/proj/bray/sql/country_data';
548
549 To copy into a file just the countries whose names start with 'A':
550
551 COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO '/usr1/proj/bray/sql/a_list_countries.copy';
552
553 To copy into a compressed file, you can pipe the output through an
554 external compression program:
555
556 COPY country TO PROGRAM 'gzip > /usr1/proj/bray/sql/country_data.gz';
557
558 Here is a sample of data suitable for copying into a table from STDIN:
559
560 AF AFGHANISTAN
561 AL ALBANIA
562 DZ ALGERIA
563 ZM ZAMBIA
564 ZW ZIMBABWE
565
566 Note that the white space on each line is actually a tab character.
567
568 The following is the same data, output in binary format. The data is
569 shown after filtering through the Unix utility od -c. The table has
570 three columns; the first has type char(2), the second has type text,
571 and the third has type integer. All the rows have a null value in the
572 third column.
573
574 0000000 P G C O P Y \n 377 \r \n \0 \0 \0 \0 \0 \0
575 0000020 \0 \0 \0 \0 003 \0 \0 \0 002 A F \0 \0 \0 013 A
576 0000040 F G H A N I S T A N 377 377 377 377 \0 003
577 0000060 \0 \0 \0 002 A L \0 \0 \0 007 A L B A N I
578 0000100 A 377 377 377 377 \0 003 \0 \0 \0 002 D Z \0 \0 \0
579 0000120 007 A L G E R I A 377 377 377 377 \0 003 \0 \0
580 0000140 \0 002 Z M \0 \0 \0 006 Z A M B I A 377 377
581 0000160 377 377 \0 003 \0 \0 \0 002 Z W \0 \0 \0 \b Z I
582 0000200 M B A B W E 377 377 377 377 377 377
583
585 There is no COPY statement in the SQL standard.
586
587 The following syntax was used before PostgreSQL version 9.0 and is
588 still supported:
589
590 COPY table_name [ ( column_name [, ...] ) ]
591 FROM { 'filename' | STDIN }
592 [ [ WITH ]
593 [ BINARY ]
594 [ DELIMITER [ AS ] 'delimiter_character' ]
595 [ NULL [ AS ] 'null_string' ]
596 [ CSV [ HEADER ]
597 [ QUOTE [ AS ] 'quote_character' ]
598 [ ESCAPE [ AS ] 'escape_character' ]
599 [ FORCE NOT NULL column_name [, ...] ] ] ]
600
601 COPY { table_name [ ( column_name [, ...] ) ] | ( query ) }
602 TO { 'filename' | STDOUT }
603 [ [ WITH ]
604 [ BINARY ]
605 [ DELIMITER [ AS ] 'delimiter_character' ]
606 [ NULL [ AS ] 'null_string' ]
607 [ CSV [ HEADER ]
608 [ QUOTE [ AS ] 'quote_character' ]
609 [ ESCAPE [ AS ] 'escape_character' ]
610 [ FORCE QUOTE { column_name [, ...] | * } ] ] ]
611
612 Note that in this syntax, BINARY and CSV are treated as independent
613 keywords, not as arguments of a FORMAT option.
614
615 The following syntax was used before PostgreSQL version 7.3 and is
616 still supported:
617
618 COPY [ BINARY ] table_name
619 FROM { 'filename' | STDIN }
620 [ [USING] DELIMITERS 'delimiter_character' ]
621 [ WITH NULL AS 'null_string' ]
622
623 COPY [ BINARY ] table_name
624 TO { 'filename' | STDOUT }
625 [ [USING] DELIMITERS 'delimiter_character' ]
626 [ WITH NULL AS 'null_string' ]
627
628
629
630
631PostgreSQL 12.2 2020 COPY(7)