copy command - Mailing list pgsql-hackers

From Jose' Soares Da Silva
Subject copy command
Date
Msg-id Pine.LNX.3.96.980428153736.1796A-100000@proxy.bazzanese.com
Whole thread Raw
List pgsql-hackers
Hi, all

PostgreSQL has two COPY commands to import/export data;

     copy [binary] <class_name> [with oids]
        {to|from} {<filename>|stdin|stdout} [using delimiters <delim>];
and...

     \copy table {from | to} <fname>

both of them work in a different way;
     In the first one you have to specify 'filename' surrounded by ''
     and if you don't specify an absolute pathname PostgreSQL uses
     $PGDATA/base/<databasename>/<filename>

     In the last one you have to specify 'filename' without by ''
     and if you don't specify an absolute pathname PostgreSQL uses
     current working directory.
     and last...  if you don't specify any parameter it show me this:

java=> \copy
connecting to new database: opy
PQexec() -- There is no connection to the backend.

Could not connect to new database. exiting

My question is:

       Why do we have two commands to doing the same operation ?
       Why are they different ?

                                                            Thanks, Jose'


pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: [HACKERS] initdb problem and operator question
Next
From: "Oliver Elphick"
Date:
Subject: Re: [HACKERS] Re: Bug#21681: postgresql: Doesn't allow granting to www-data