473,289 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

using the "copy from" command

Hi,

I'm a first-time user of the "Copy ... From..." command, and I'm trying
to load a table from a text flat file.

http://www.postgresql.org/docs/7.4/static/sql-copy.html

I'm getting the following error. Any help will be appreciated. Thank
you.

[mknepper@barney datafiles]$ psql -U postgres medispan
Welcome to psql 7.3.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

medispan=# copy mmw_ade_com from
'/home/mknepper/medispan/datafiles/mmwadecom.txt' with delimiter '|';
": can't parse "ne 1, pg_atoi: error in "14608
medispan=#
Table schema:

CREATE TABLE mmw_ade_com
(
gpi VARCHAR(14) NOT NULL,
mcid INTEGER NOT NULL,
restrictionid INTEGER NOT NULL,
sequencenumber SMALLINT NOT NULL,
textid INTEGER,
PRIMARY KEY (gpi, mcid, restrictionid, sequencenumber)
);

example of data, from the TXT flat file, called mmwadecom.txt:

01100040100310|5|0|10|14608
01100040100310|8|0|10|17377
01100040100310|8|0|20|18061
01100040100310|8|0|30|14608
01100040100310|22|0|10|18025
01100040100310|30|0|10|14608
01100040100310|36|0|10|14608
01100040100310|115|0|10|13937
01100040100310|115|0|20|18041
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 23 '05 #1
2 2867
Knepper, Michelle wrote:
medispan=# copy mmw_ade_com from
'/home/mknepper/medispan/datafiles/mmwadecom.txt' with delimiter '|';
": can't parse "ne 1, pg_atoi: error in "14608


Looks like bad data in line 14608. What does that line of your input
file look like?

Joe
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #2
Joe Conway wrote:
Knepper, Michelle wrote:
medispan=# copy mmw_ade_com from
'/home/mknepper/medispan/datafiles/mmwadecom.txt' with delimiter '|';
": can't parse "ne 1, pg_atoi: error in "14608


Looks like bad data in line 14608. What does that line of your input
file look like?


Strike that -- it actually is a problem in line 1, isn't it (you cut off
the line number in the error message above)? It might be end-of-line
character problem. Was your input file created or edited on Windows by
chance (i.e. ends in \r\n instead of \n)?

Joe
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: cbb | last post by:
I'm using ver. 7.4.6.1 from a generic install of Fedora Core 3. I always get "permission denied" error when using the COPY command to load to a table from a text file. I'm logged on to the db as...
1
by: Deepa K | last post by:
Hi All, Is it possible to insert n rows with 1 or 2 invalid rows using copy command. I used it, it rollbacks everything even if 1 row gets an error. Is their any other way to do it. TIA --...
2
by: Don Isgitt | last post by:
Hi, I am recreating a database and its applications onto a new server and new software; old version of pg was 7.2.4 and new version is gds2=# select version(); version ...
1
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't...
1
by: Bob Powell | last post by:
To whom it may concern: Does anyone know if it is possible to make the COPY command in postgres verbose. It would be very helpful if an error would generate when something goes wrong with a...
4
by: Jon Asher | last post by:
Hi, I'm trying to do a simple import of a comma delimited text file with COPY but it's returning an error. The file has been granted all permissions in Linux, so it's not clear to me what the...
4
by: Kevin Murphy | last post by:
This is a tip for the record in case it helps somebody else in the future. I have an import script that relies on a stored procedure that runs as a trigger on inserts into a temporary table. ...
0
by: Robert Fitzpatrick | last post by:
I have a PHP script that was having problems using the COPY command with files around 1500 lines in size. The script will build the copy data from incoming CSV file into a temp file, then start a...
3
by: devinath | last post by:
I came across a problem while running the system file. When the copy command is run using system command , it doesn’t copy files which have size of 0kb. But the same command works if run thru the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.