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

Поиск
Список
Период
Сортировка
От Sherman Brown
Тема SQL state: 22P02 Error during a COPY FROM a CSV file
Дата
Msg-id 3256656.1231397895147.JavaMail.root@elwamui-darkeyed.atl.sa.earthlink.net
обсуждение исходный текст
Ответы Re: SQL state: 22P02 Error during a COPY FROM a CSV file
Re: SQL state: 22P02 Error during a COPY FROM a CSV file
Список 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,DateAdded,Bit Rate,Sample Rate,Volume Adjustment,Kind,Equalizer,Comments,Play Count,Last Played,Skip
Count,LastSkipped,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/200916:38,1/1/2009 16:38,128,44100,,AAC audio file,,,1,1/1/2009
16:47,,,,C:\Documentsand Settings\SB\My Documents\My Music\iTunes\iTunes Music\Susan Tedeschi\Back To The River\01
TalkingAbout.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/200916:38,1/1/2009 16:38,128,44100,,AAC audio file,,,1,1/1/2009
16:51,,,,C:\Documentsand 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/200916:39,1/1/2009 16:39,128,44100,,AAC audio file,,,1,1/1/2009
16:57,,,,C:\Documentsand Settings\SB\My Documents\My Music\iTunes\iTunes Music\Susan Tedeschi\Back To The River\03 Back
ToThe 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
asolution. 

Any help or advice would be appreciated.

Sherman






В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: selecting recs based on a tmp tbl vals that are wildcarded ?
Следующее
От: Laurent ROCHE
Дата:
Сообщение: version number between pgdump and server