using the "copy from" command

From: "Knepper, Michelle" <mknepper(at)intellidot(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: using the "copy from" command
Date: 2004-03-01 21:44:39
Message-ID: 57E2A340D65EB240B071FEED12F4777B0794DB@merlin.intellidot.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2004-03-01 22:04:22 Re: using the "copy from" command
Previous Message Mihai RUSU 2004-03-01 21:35:20 libpq API for PQcmdTuples()