Error loading data with COPY

From: Fred Wohlfert <fredwohlfert(at)ehbmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Error loading data with COPY
Date: 2004-11-18 13:33:06
Message-ID: 419CA492.70801@ehbmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I am in the prototyping phase of a conversion from dbase to postgresql

I am trying to load data with the copy function,-------

*ham-existing=# \copy invst from '/home/fmwdba/transcoma' using
delimiters ','

I then get the following error --------

ERROR: value too long for type character(7)
CONTEXT: COPY invst, line 1, column stknum: "'0020338'"
ham-existing=#*

however, if I use the insert command and give the field names the data
will load. Can anyone see what I am doing wrong? I need to use the
copy function as I have a lot of data to load.

This is how I created the table
CREATE TABLE Invst (
STKNUM CHAR(7) NOT NULL,
RATIO NUMERIC(4,1),
PUBLET_ CHAR(1),
SORTNUM CHAR(1),
BINNUM CHAR(4),
BIN2 CHAR(4),
WEIGHT NUMERIC(5,2),
MUSICCDSLS NUMERIC(4),
AZTOOHIGH CHAR(1),
AZMAXPRICE NUMERIC(7,2),
OVERSIZE CHAR(1),
KEEPOFFWEB CHAR(1),
NEWSTKNUM CHAR(7),
ROLL_NUM NUMERIC(1),
DATEONAZ DATE,
AZCURINV NUMERIC(3)
);

CREATE UNIQUE INDEX XPKInvst ON Invst
(
STKNUM
);

ALTER TABLE Invst
ADD PRIMARY KEY (STKNUM);

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Sullivan 2004-11-18 15:41:46 Re: Usenet Discussion Proposal
Previous Message Harry Smith 2004-11-18 03:01:46 Usenet Discussion Proposal