Re: Error in using copy command

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: Sindile Bidla <sindile(dot)bidla(at)gmail(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Error in using copy command
Date: 2011-05-11 12:28:16
Message-ID: BANLkTi=LQAb_W860_O3XtgBjOrqTv2EAqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 11 May 2011 14:09, Sindile Bidla <sindile(dot)bidla(at)gmail(dot)com> wrote:
>
> I get the following error on running COPY - array value must start with "{"
> or dimension information CONTEXT: copy tablename, line 1, column field1:
> ""1"".
> the structure of the csv file is: "1","1","BLOEMSMOND SETTLEMENT
> AGRICULTURAL HOLDING","00000","","","T618/1943","6.3870 H","NORTHERN
> CAPE","","*"
> my copy command looks is: COPY tablename FROM myfile DELIMITER ',';

Try:

COPY tablename FROM 'myfile'
DELIMITER ','
CSV QUOTE '"' ESCAPE '\';

(ESCAPE might be wrong depending on what your CSV looks like if one of
the fields contains a " character.)

--
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Wood 2011-05-11 12:34:51 Re: Error in using copy command
Previous Message Sindile Bidla 2011-05-11 12:09:17 Error in using copy command