Re: copy command with PSQL

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: shaunnx(at)my-deja(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: copy command with PSQL
Date: 2001-11-06 16:38:42
Message-ID: 20011106163842.90342.qmail@web20803.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

You need some kind of field separator in your data, a
single character that is not found elsewhere in your
data.
That means you will need to find a way to get your
source application to export the data with separator
characters in place; or else you will need to edit the
output to add those separators. How you do the
editing depends on the nature of the data and the
format of the output. If you send me a sample I may
be able to suggest something for you (if the first
alternative is unworkable for you).
I have written some notes on the use of "copy", which
you can find at the techdocs site:
http://techdocs.postgresql.org

--- X <shaunnx(at)my-deja(dot)com> wrote:
> Sorry if this is a repost --
>
> Howdy:
>
> Regarding the 'copy' command, are there any examples
> as to it's usage? Let me give you some background
> on
> what I'm doing.
>
> From my DB2/Mainframe to NT/DB2Connect environment,
> I have
> an SQL script that pulls data down. I can append
> the
> data into a flat ASCII file format, but because some
> of the data
> in some columns are broken up, it doesn't seem
> possible to
> import the data into Postgres. (e.g., the address
> col. may
> have "66 w. baker street" ... but the format of the
> file is
> space delimited, so each group of words are looked
> at as a
> column).
>
> DB2 will, however, let me create a file that is a
> binary
> format. (e.g., EXPORT to F:\backup\test.ixf of IXF)
> After looking at some of the Postgres documentation,
> there is a copy command that says, 'copies data
> between files
> and tables'.
>
> Now, I'm trying to figure out how can I copy this
> binary file
> and load it into a table on Postgres? Is it
> possible?
>
> Thanks!
>
> -X
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org
> so that your
> message can get through to the mailing list cleanly

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bpalmer 2001-11-06 16:49:41 Re: Howto change column length
Previous Message Fernando Schapachnik 2001-11-06 16:38:03 Re: postgres 7.1.1 on Freebsd 4.3?

Browse pgsql-sql by date

  From Date Subject
Next Message Fernando Nasser 2001-11-06 16:56:31 Re: design tool
Previous Message Josh Berkus 2001-11-06 16:36:29 Re: Left join error