Unable to copy data from csv file, solution of problem

From: e-letter <inpost(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Unable to copy data from csv file, solution of problem
Date: 2009-12-29 11:06:00
Message-ID: 298a6f60912290306r458bc4c3t221e7197ae590e14@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Readers,

This is for other novices that experienced the same error. Solved by
expert postgresql users at the irc channel.

I created a database and table successfully

I tried the following command and receiving the following command
terminal output:

CREATE TABLE test();
CREATE TABLE
...=# COPY activity FROM '/path/to/test.csv';
ERROR: extra data after last expected column
CONTEXT: COPY activity, line 1: "a,b"

The csv file is:

a,b
1,2

The error is due to the mistake of creating a blank table. It is
necessary to create a table with the columns configured to resemble
the columns in the csv file.

Columns can be configured manually using the 'create table' command
instructions, or use 'extract load transform' (ELT) software such as
pgloader, or kettle, or others.

Browse pgsql-novice by date

  From Date Subject
Next Message Susan M Farley 2010-01-04 00:29:15 How to create a Java function in PostgreSQL
Previous Message Jasen Betts 2009-12-29 02:40:03 Re: CHILD WITHOUT PARENT (TEMPORARILY)