pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Harry Yau <harry.yau@regaltronic.com>
To: pgsql-sql@postgresql.org
Subject: Problem with COPY FROM
Date: Sat, 18 Jan 2003 14:16:09 +0800
Message-ID: <3E28F128.BA73A07E@regaltronic.com> (raw)

Hi all,
I am trying to copy some date from a text file to pgsql.
I am using pgsql 7.3 version. The problem i am face is that i try to
copy a TEXT field to a table.
I have serveral line in this field.
Let say, I have  a table T1, and three fields with it, F1, F2, F3.
F1 is varchar(5), F2 is text and F3 is int
When I pg_dump T1, it show something like
........
COPY T1(F1, F2) FROM stdin;
00001   Line1\r\nLine2\r\nLine3\r\n   1
00002   LineA\r\nLineB\r\nLineB\r\n   3
\.
.....
I cut it out and run it. It get me the following error message:
     ERROR:  copy: line 1, value too long for type character(5)

Then I thought, the tab(\t) is messed up, so I delete all the space in
between the fields and put a tab by myself. The funny thing happen.
Sometime, it give me the error message
    ERROR:  copy: line 2, Missing data for column "F2"

However, somtime it have no error message and no "COPY" to identicate
the sussecc of the command. ( In fact, it didn't copy the data for me!)

Please, could anyone help me a bit with the COPY FROM with text field.

Thank You very Much!

Harry Yau









Message-ID: <3E28F128.BA73A07E@regaltronic.com>
Permalink:  ../3E28F128.BA73A07E@regaltronic.com/
Also on:    postgresql.org/message-id/3E28F128.BA73A07E@regaltronic.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: harry.yau@regaltronic.com
  Subject: Re: Problem with COPY FROM
  In-Reply-To: <3E28F128.BA73A07E@regaltronic.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox