From: Nabil <nabil(at)kramer-smilko(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject:
Date: 2007-02-21 17:42:05
Message-ID: C2E67800-22B2-4739-A4B8-7891412334AC@kramer-smilko.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi everyone. I'm running postgresql 7.4 and I'm trying to import some
data from a CSV file using this command:

COPY vendor (vc, vname, address, city, state, zip, phone, rent_to_vc)
FROM '/home/nabil/vendordata.csv' DELIMITER ',';

but I get an error:
ERROR: malformed array literal: "{109 URBAN AVENUE"
SQL state: 22P02
Context: COPY vendor, line 2, column address: "{109 URBAN AVENUE"

the data line is:
AB00045,GOES KING,{109 URBAN AVENUE,},WESTBURY,NY,
11590-4800,800-524-1556,1
and the code for the address column:
ALTER TABLE vendor ADD COLUMN address character varying(30)[];
ALTER TABLE vendor ALTER COLUMN address SET STORAGE EXTENDED;
ALTER TABLE vendor ALTER COLUMN address SET NOT NULL;
^ copied from the SQL pane in pgAdmin

I dont know why I'm getting this error... If I remove the comma at
the end of AVENUE the error goes away but I created the address
column with a data type of varchar(30)[2]. Does any one know what I'm
doing wrong?

Responses

  • Re: at 2007-02-21 22:44:31 from Phillip Smith
  • Re: at 2007-02-22 06:48:12 from Tom Lane

Browse pgsql-novice by date

  From Date Subject
Next Message Allan Sullivan 2007-02-21 18:07:51 "Stream does not support Writing" exception
Previous Message Shane Ambler 2007-02-20 17:27:49 Re: Questions from a Newbie