Help with copy (loading TSV file into table as text)

From: Allan Kamau <kamauallan(at)gmail(dot)com>
To: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Help with copy (loading TSV file into table as text)
Date: 2011-10-24 19:23:28
Message-ID: CAF3N6oSTE=vSNyPABsa70VWV+nzgL56ze7FDFOpEc2ZrrKB3pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I have a tab delimited file with over a thousand fields (columns)
which I would like to import into postgreSQL.

I have opted to import the entire record (line) of this file into a
single field in a table, one table record per file line. Later split
the contents of the field accordingly into an array for further
processing and decomposition.

I am using the COPY command as follows
#COPY a.t(raw_data)FROM '/data/tmp/t.txt';

and it reports "ERROR: extra data after last expected column".

#COPY a.t(raw_data)FROM '/data/tmp/t.txt' WITH FORMAT text;

yields "ERROR: syntax error at or near "FORMAT"

I am running PostgreSQL 9.1.1 compiled from source and deployed on
Fedora Core 14 64bit. Below is the output of version();

m=> SELECT VERSION();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.1.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.5 20101112 (Red Hat 4.4.5-2), 64-bit
(1 row)

Allan.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2011-10-24 19:36:05 Re: [pgadmin-support] Help for Migration
Previous Message Thomas Kellerer 2011-10-24 18:24:36 Re: PostGIS in a commercial project