Provided by: manpages-zh_1.5.2-1_all bug

NAME

       COPY -

SYNOPSIS

       COPY tablename [ ( column [, ...] ) ]
           FROM { 'filename' | STDIN }
           [ [ WITH ]
                 [ BINARY ]
                 [ OIDS ]
                 [ DELIMITER [ AS ] 'delimiter' ]
                 [ NULL [ AS ] 'null string' ] ]

       COPY tablename [ ( column [, ...] ) ]
           TO { 'filename' | STDOUT }
           [ [ WITH ]
                 [ BINARY ]
                 [ OIDS ]
                 [ DELIMITER [ AS ] 'delimiter' ]
                 [ NULL [ AS ] 'null string' ] ]

DESCRIPTION

       COPY  PostgreSQL COPY TO   COPY FROM

        COPY   COPY FROM

         COPY  PostgreSQL   STDIN  STDOUT

PARAMETERS

       tablename

       column

       filename

       STDIN

       STDOUT

       BINARY
                 DELIMITERSNULL

       OIDS
               OID  OID  OIDS

       delimiter
                tab

       null string
                NULL  \N -N

              Note: :  COPY FROM NULL  COPY TO

NOTES

       COPY

       BINARY /

        COPY TO   COPY FROM

       COPY   PostgreSQL ID COPY

          COPY   psql   \copy  \copy   COPY  FROM STDIN  COPY TO STDOUT / psql
       \copy

         COPY   COPY TO   COPY FROM

       COPY FROM

       COPY  COPY TO  COPY FROM     VACUUM

FILE FORMATS

   TEXT FORMAT
         BINARY  COPY       NULL   COPY FROM   OIDS OID

        \.   3.0

        \ COPY

         COPY TO COPY FROM   \N  \N  \\N

       COPY FROM
              \b  (ASCII 8)

              \f  (ASCII 12)

              \n  (ASCII 10)

              \r  (ASCII 13)

              \t  (ASCII 9)

              \v  (ASCII 11)

              \digits ()
        COPY TO

        N. (\.)  (\N)

         COPY  \n  \r

       They are also highly vulnerable to  corruption  if  the  COPY  file  is
       transferred  across  different  machines  (for  example,  from  Unix to
       Windows or vice versa).

       COPY TO  Unix ("\n")  MS Windows "\r\n"COPY COPY TO STDOUT   "\n"  COPY
       FROM   COPY FROM

   BINARY FORMAT
        PostgreSQL 7.4  COPY BINARY

   FILE HEADER
         15

       Signature
              11- PGCOPY\n\377\r\n\0 ---   8

       Flags field
               32   0LSB 31 MSB ---   16 - 31    0-15

              Bit 16
                       1 OID 0

               32

   TUPLES
        16  32 -1  NULL  NULL

        COPY BINARY

        PostgreSQL  *send  *recv  src/backend/utils/adt/

        OID OID  ---  4  8  OID OID  OID

   FILE TRAILER
         -1  16

         -1

EXAMPLES

         |

       COPY country TO STDOUT WITH DELIMITER '|';

         Unix country

       COPY country FROM '/usr1/proj/bray/sql/country_data';

         STDIN

       AF      AFGHANISTAN
       AL      ALBANIA
       DZ      ALGERIA
       ZM      ZAMBIA
       ZW      ZIMBABWE

         tab

         Linux/i586   Unix  od -c   char(2)  text integer null

       0000000   P   G   C   O   P   Y  \n 377  \r  \n  \0  \0  \0  \0  \0  \0
       0000020  \0  \0  \0  \0 003  \0  \0  \0 002   A   F  \0  \0  \0 013   A
       0000040   F   G   H   A   N   I   S   T   A   N 377 377 377 377  \0 003
       0000060  \0  \0  \0 002   A   L  \0  \0  \0 007   A   L   B   A   N   I
       0000100   A 377 377 377 377  \0 003  \0  \0  \0 002   D   Z  \0  \0  \0
       0000120 007   A   L   G   E   R   I   A 377 377 377 377  \0 003  \0  \0
       0000140  \0 002   Z   M  \0  \0  \0 006   Z   A   M   B   I   A 377 377
       0000160 377 377  \0 003  \0  \0  \0 002   Z   W  \0  \0  \0  \b   Z   I
       0000200   M   B   A   B   W   E 377 377 377 377 377 377

COMPATIBILITY

         SQL  COPY

        7.3

       COPY [ BINARY ] tablename [ WITH OIDS ]
           FROM { 'filename' | STDIN }
           [ [USING] DELIMITERS 'delimiter' ]
           [ WITH NULL AS 'null string' ]

       COPY [ BINARY ] tablename [ WITH OIDS ]
           TO { 'filename' | STDOUT }
           [ [USING] DELIMITERS 'delimiter' ]
           [ WITH NULL AS 'null string' ]

       Postgresql  <laser@pgsqldb.org>