copy man page on aLinux

Man page or keyword search:  
man Server   7435 pages
apropos Keyword Search (all sections)
Output format
aLinux logo
[printable version]

COPY()				 SQL Commands				COPY()

NAME
       COPY - copy data between a file and a table

SYNOPSIS
       COPY tablename [ ( column [, ...] ) ]
	   FROM { 'filename' | STDIN }
	   [ [ WITH ]
		 [ BINARY ]
		 [ OIDS ]
		 [ DELIMITER [ AS ] 'delimiter' ]
		 [ NULL [ AS ] 'null string' ]
		 [ CSV [ HEADER ]
		       [ QUOTE [ AS ] 'quote' ]
		       [ ESCAPE [ AS ] 'escape' ]
		       [ FORCE NOT NULL column [, ...] ]

       COPY tablename [ ( column [, ...] ) ]
	   TO { 'filename' | STDOUT }
	   [ [ WITH ]
		 [ BINARY ]
		 [ HEADER ]
		 [ OIDS ]
		 [ DELIMITER [ AS ] 'delimiter' ]
		 [ NULL [ AS ] 'null string' ]
		 [ CSV [ HEADER ]
		       [ QUOTE [ AS ] 'quote' ]
		       [ ESCAPE [ AS ] 'escape' ]
		       [ FORCE QUOTE column [, ...] ]

DESCRIPTION
       COPY  moves  data  between  PostgreSQL  tables and standard file-system
       files. COPY TO copies the contents of a table to	 a  file,  while  COPY
       FROM copies data from a file to a table (appending the data to whatever
       is in the table already).

       If a list of columns is specified, COPY will only copy the data in  the
       specified columns to or from the file.  If there are any columns in the
       table that are not in the  column  list,	 COPY  FROM  will  insert  the
       default values for those columns.

       COPY  with a file name instructs the PostgreSQL server to directly read
       from or write to a file. The file must be accessible to the server  and
       the name must be specified from the viewpoint of the server. When STDIN
       or STDOUT is specified, data is transmitted via the connection  between
       the client and the server.

PARAMETERS
       tablename
	      The name (optionally schema-qualified) of an existing table.

       column An  optional  list of columns to be copied. If no column list is
	      specified, all columns will be used.

       filename
	      The absolute path name of the input or output file.

       STDIN  Specifies that input comes from the client application.

       STDOUT Specifies that output goes to the client application.

       BINARY Causes all data to be stored or read  in	binary	format	rather
	      than  as	text.  You  cannot specify the DELIMITER, NULL, or CSV
	      options in binary mode.

       OIDS   Specifies copying the OID for each row. (An error is  raised  if
	      OIDS is specified for a table that does not have OIDs.)

       delimiter
	      The  single  character  that  separates  columns within each row
	      (line) of the file. The default is a tab character in text mode,
	      a comma in CSV mode.

       null string
	      The  string  that	 represents  a	null  value. The default is \N
	      (backslash-N) in text mode, and a empty value with no quotes  in
	      CSV mode. You might prefer an empty string even in text mode for
	      cases where you don't  want  to  distinguish  nulls  from	 empty
	      strings.

	      Note:  When  using  COPY	FROM,  any data item that matches this
	      string will be stored as a null value, so you should  make  sure
	      that you use the same string as you used with COPY TO.