pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fred Wohlfert <fredwohlfert@ehbmail.com>
To: pgsql-admin@postgresql.org
Subject: Error loading data with COPY
Date: Thu, 18 Nov 2004 08:33:06 -0500
Message-ID: <419CA492.70801@ehbmail.com> (raw)

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);






view thread (3+ messages)  latest in thread

Message-ID: <419CA492.70801@ehbmail.com>
Permalink:  ../419CA492.70801@ehbmail.com/
Also on:    postgresql.org/message-id/419CA492.70801@ehbmail.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: fredwohlfert@ehbmail.com
  Subject: Re: Error loading data with COPY
  In-Reply-To: <419CA492.70801@ehbmail.com>
  References: <419CA492.70801@ehbmail.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