SQL state: 22P02 Error during a COPY FROM a CSV file

From: Sherman Brown <ardcsb(at)earthlink(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: SQL state: 22P02 Error during a COPY FROM a CSV file
Date: 2009-01-08 06:58:15
Message-ID: 3256656.1231397895147.JavaMail.root@elwamui-darkeyed.atl.sa.earthlink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am new to PostgresSQL and I am trying to populate a table with data from a CSV file.
I have PostgresSQL loaded on a windows XP machine with multiple hard drives.
The CSV file was generated from Excel 2007.
I have a couple of fields with embedded commas as show in the second line of the data.

This is the table structure:
CREATE TABLE mp3.songs
(
"Name" character varying[] NOT NULL,
"Artist" character varying[] NOT NULL,
"Composer" character varying[],
"Album" character varying[] NOT NULL,
"Grouping" character varying[],
"Genre" character varying[],
"Size" integer,
"Time" integer,
"Disc Number" integer,
"Disc Count" integer,
"Track Number" integer,
"Track Count" integer,
"Year" date,
"Date Modified" date,
"Date Added" date,
"Bit Rate" integer,
"Sample Rate" integer,
"Volume Adjustment" integer,
"Kind" character varying[],
"Equalizer" character varying[],
"Comments" character varying[],
"Play Count" integer,
"Last Played" date,
"Skip Count" integer,
"Last Skipped" date,
"My Rating" character varying[],
"Location" character varying[],
CONSTRAINT songs_pkey PRIMARY KEY ("Name", "Artist", "Album")
)
WITH (OIDS=FALSE)
TABLESPACE mp3;
ALTER TABLE mp3.songs OWNER TO postgres;

Here are the first 4 lines from my CSV file:
Name,Artist,Composer,Album,Grouping,Genre,Size,Time,Disc Number,Disc Count,Track Number,Track Count,Year,Date Modified,Date Added,Bit Rate,Sample Rate,Volume Adjustment,Kind,Equalizer,Comments,Play Count,Last Played,Skip Count,Last Skipped,My Rating,Location
Talking About,Susan Tedeschi,"Susan Tedeschi, Doyle Bramhall II & Derek Trucks",Back To The River,,Blues,4175697,263,1,1,1,11,2008,1/1/2009 16:38,1/1/2009 16:38,128,44100,,AAC audio file,,,1,1/1/2009 16:47,,,,C:\Documents and Settings\SB\My Documents\My Music\iTunes\iTunes Music\Susan Tedeschi\Back To The River\01 Talking About.m4a
700 Houses,Susan Tedeschi,"Susan Tedeschi, John Leventhal & Ted Pecchio",Back To The River,,Blues,4401663,278,1,1,2,11,2008,1/1/2009 16:38,1/1/2009 16:38,128,44100,,AAC audio file,,,1,1/1/2009 16:51,,,,C:\Documents and Settings\SB\My Documents\My Music\iTunes\iTunes Music\Susan Tedeschi\Back To The River\02 700 Houses.m4a
Back To The River,Susan Tedeschi,Susan Tedeschi & Tony Joe White,Back To The River,,Blues,3827357,236,1,1,3,11,2008,1/1/2009 16:39,1/1/2009 16:39,128,44100,,AAC audio file,,,1,1/1/2009 16:57,,,,C:\Documents and Settings\SB\My Documents\My Music\iTunes\iTunes Music\Susan Tedeschi\Back To The River\03 Back To The River.m4a

Here is my COPY command:

Copy mp3.songs from 'G:/PostgreSQL/8.3/data/RecAdded.csv' with DELIMITER AS ',' CSV HEADER QUOTE AS '"'

Here is the error I am getting:

ERROR: array value must start with "{" or dimension information
CONTEXT: COPY songs, line 2, column Name: "Talking About"

********** Error **********

ERROR: array value must start with "{" or dimension information
SQL state: 22P02
Context: COPY songs, line 2, column Name: "Talking About"

I think that the problem may be simple but I cannot find any references or examples in the Archives to help me discover a solution.

Any help or advice would be appreciated.

Sherman

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2009-01-08 07:06:52 Re: Per-user schemas with inherited skeleton.
Previous Message Craig Ringer 2009-01-08 06:39:38 Re: Per-user schemas with inherited skeleton.