next up previous contents index
Next: Summary Up: Importing and Exporting Data Previous: Backslashes and NULL Values

COPY Tips

You must use full path names with the COPY command because the database server runs in a different directory than the psql client. Files are read and written by the postgres user, so postgres must have permission to read the file for COPY...FROM and directory write permission for COPY...TO. Because COPY uses the local file system, users connecting over a network cannot use file names. They can use stdin  and stdout , or psql's \copy command. 

By default, the system-generated OID  column is not written out, and loaded rows receive new OIDs. COPY...WITH OIDS allows OIDs to be written and read.

COPY writes only entire tables. To COPY only part of a table, use SELECT...INTO  TEMPORARY TABLE  with an appropriate WHERE clause and then COPY the temporary table to a file.

See the COPY manual page for more detailed information.


Bruce Momjian
2001-05-09