pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
error loading data with copy
3+ messages / 2 participants
[nested] [flat]

* error loading data with copy
@ 2004-11-17 16:43  Fred Wohlfert <fredwohlfert@ehbmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Fred Wohlfert @ 2004-11-17 16:43 UTC (permalink / raw)
  To: pgsql-admin

I am trying to load data with the copy function,

*ham-existing=# \copy invst from '/home/fmwdba/transcoma' using
delimiters ','
\.
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 laod.

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),
       BIN3                 CHAR(4),
       BIN4                 CHAR(4),
       PUBSTNUM             CHAR(10),
       TITLE                CHAR(40),
       BUYPRICE             NUMERIC(6),
       SELLPRICE            NUMERIC(6),
       INVENTORY1           NUMERIC(4),
       INVENTORY2           NUMERIC(4),
       CURINV               NUMERIC(4),
       COPYPUR              NUMERIC(4),
        RESTOCKBIN           NUMERIC(4),
       H8DATE               DATE,
       BUYER                CHAR(2),
       PRICED               CHAR(2),
       PULP                 NUMERIC(4),
       PUBPRICE             NUMERIC(7,2),
       HALFCOM              NUMERIC(7,2),
       KEEP2                CHAR(1),
       NEWDATE2             DATE,
       CONDITION            CHAR(1),
       FEATURE              CHAR(2),
       RESTOCKEDX           NUMERIC(2),
       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);






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Error loading data with COPY
@ 2004-11-18 13:33  Fred Wohlfert <fredwohlfert@ehbmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Fred Wohlfert @ 2004-11-18 13:33 UTC (permalink / raw)
  To: 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);






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: error loading data with copy
@ 2004-11-21 08:43  Michael Fuhr <mike@fuhr.org>
  parent: Fred Wohlfert <fredwohlfert@ehbmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Michael Fuhr @ 2004-11-21 08:43 UTC (permalink / raw)
  To: Fred Wohlfert <fredwohlfert@ehbmail.com>; +Cc: pgsql-admin

On Wed, Nov 17, 2004 at 11:43:05AM -0500, Fred Wohlfert wrote:

> *ham-existing=# \copy invst from '/home/fmwdba/transcoma' using
> delimiters ','
> \.
> ERROR:  value too long for type character(7)
> CONTEXT:  COPY invst, line 1, column stknum: "'0020338'"

Looks like the stknum values in the file have extraneous single
quotes.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2004-11-21 08:43 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-17 16:43 error loading data with copy Fred Wohlfert <fredwohlfert@ehbmail.com>
2004-11-21 08:43 ` Michael Fuhr <mike@fuhr.org>
2004-11-18 13:33 Error loading data with COPY Fred Wohlfert <fredwohlfert@ehbmail.com>

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