convert text file to database

From: e-letter <inpost(at)gmail(dot)com>
To: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: convert text file to database
Date: 2008-04-18 13:29:14
Message-ID: 298a6f60804180629i46d0ab41t7b5f95cd1b7e6d8c@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Readers,

I re-formatted an extract from my file of chess matches to:

Event,Online Game,Site,www.flyordie.com,Date,yyyy/mm/dd,Round,1,White,djride,Black,kasparov777,Result,1-0,Termination,normal,UTCDate,2008/01/05,TimeControl,1200,moves,1.
c4 e5...25. Qh7# 1-0
Event,Online Game,Site,www.flyordie.com,Date,2008/01/05,Round,1,White,pawnsrow,Black,djride,Result,0-1,Termination,normal,UTCDate,yyyy/mm/dd,TimeControl,1200,moves,1.
d4 d5...33. Bf3 Rxe5 0-1

I tried to import the csv file using the command:

chessmatches=# COPY chessgames FROM '/absolute/path/filename.csv';
ERROR: invalid input syntax for integer: "Event..."

CONTEXT: COPY chessgames, line 1, column id: "Event,..."

My first thoughts are that I need to create a first column entitle
'column id' but there is no reference to the requirement for this in
the section of the manual COPY. SO what is required please?

Thanks,

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2008-04-18 14:49:52 Re: convert text file to database
Previous Message Nils Zierath 2008-04-18 08:36:11 Re: Remote / network connection fails