Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sherman Brown wrote:
> CREATE TABLE mp3.songs
> (
>   "Name" character varying[] NOT NULL,
>   "Artist" character varying[] NOT NULL,
>   "Composer" character varying[],
>   "Album" character varying[] NOT NULL,
...

> 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

> 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"

The problem is that you've defined your "name" column as being an array
of varchar values. That's not what you're providing.

=> CREATE TABLE mp3s (track_name text[]);
CREATE TABLE
=> INSERT INTO mp3s (track_name) VALUES ( '{"first item", "second item"}' );
INSERT 0 1

See the manual: data-types, arrays for more details.

-- 
  Richard Huxton
  Archonet Ltd

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux