Question about COPY command
Hi,
A basic question about the COPY command syntax....
This is the syntax in the postgres manual.
COPY *tablename* [ ( *column* [, ...] ) ]
FROM { '*filename*' | STDIN }
......
.....
What is the difference between copying from 'filename' and copying
from 'stdin' ???
Thanks
Josh
In response to Josh Harrison :
Hi,
A basic question about the COPY command syntax....
This is the syntax in the postgres manual.COPY tablename [ ( column [, ...] ) ]
FROM { 'filename' | STDIN }
......
.....What is the difference between copying from 'filename' and copying from 'stdin' ???
Within psql, stdin is your keyboard. Otherwise, you can use COPY in a
UNIX-PIPE.
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
On 08/01/2009 13:39, Josh Harrison wrote:
What is the difference between copying from 'filename' and copying from 'stdin' ???
You'll see COPY from stdin in pg_dump scripts - when restoring via psql,
the entire input to psql is coming from stdin, so COPY FROM stdin tells
it to expect the data from there also.
COPY FROM <filename> tells it to take the input from an external disk file.
Ray.
------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------
On Thu, Jan 8, 2009 at 8:52 AM, A. Kretschmer <
andreas.kretschmer@schollglas.com> wrote:
In response to Josh Harrison :
Hi,
A basic question about the COPY command syntax....
This is the syntax in the postgres manual.COPY tablename [ ( column [, ...] ) ]
FROM { 'filename' | STDIN }
......
.....What is the difference between copying from 'filename' and copying from
'stdin' ???
Within psql, stdin is your keyboard. Otherwise, you can use COPY in a
UNIX-PIPE.
Thanks... Is it possible to use COPY command to copy data from oracle to
postgresql database? I currently use jdbc to do this but its really
slow...so I wanted to try the COPY command ? So if i have to do this using
COPY command then I have to 'exp' the oracle table to a flat file and read
it using COPY command into postgresql tables ? Is there a way to do this
without dumping the data into a file ?
My question is is it possible to read the oracle data from the oracle
database and copy them into postgresql database directly by using COPY
command instead of jdbc preparedstatement(INSERT command) ?
Thanks
Josh
Show quoted text
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
2009/1/9 Josh Harrison <joshques@gmail.com>:
My question is is it possible to read the oracle data from the oracle
database and copy them into postgresql database directly by using COPY
command instead of jdbc preparedstatement(INSERT command) ?
Should be possible; just got to make sure that you have all the formatting
right, you may need something like sed or awk to make them match ...
Of course it also depends on the complexity of "database"; if you
have several tables w/ referential integrity then copy obviously wouldn't
be the right tool for the job.
Thanks
Josh
Cheers,
Andrej
On fim, 2009-01-08 at 08:39 -0500, Josh Harrison wrote:
Hi,
A basic question about the COPY command syntax....
This is the syntax in the postgres manual.COPY tablename [ ( column [, ...] ) ]
FROM { 'filename' | STDIN }
......
.....What is the difference between copying from 'filename' and copying from 'stdin' ???
The most important distinction is that 'filename' refers to a file
residing on the *server*, but STDIN is clientside.
For security, the file variant requires superuser privileges.
gnari