Problem with COPY FROM

From: Harry Yau <harry(dot)yau(at)regaltronic(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Problem with COPY FROM
Date: 2003-01-18 06:16:09
Message-ID: 3E28F128.BA73A07E@regaltronic.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Kurt Roeckx 2003-01-19 13:33:20 Selecting a non-locked row.
Previous Message Josh Berkus 2003-01-18 00:31:07 Re: Can I do this?