Skip site navigation (1) Skip section navigation (2)

Re: Error in using copy command

From: Sindile Bidla <sindile(dot)bidla(at)gmail(dot)com>
To: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Error in using copy command
Date: 2011-05-11 16:11:06
Message-ID: BANLkTimW7gq9PNJHvNR6rzUvwMsTyWa0BA@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
It works and thank you

On 11 May 2011 15:42, Michael Wood <esiotrot(at)gmail(dot)com> wrote:

> On 11 May 2011 15:07, Sindile Bidla <sindile(dot)bidla(at)gmail(dot)com> wrote:
> > I have modified my command to: COPY tablename FROM 'myfile' DELIMITER ','
> > CSV QUOTE '"' ESCAPE E'\\';
> > following your suggestion but I am still getting the same error
>
> What is the table definition?
>
> > On 11 May 2011 14:34, Michael Wood <esiotrot(at)gmail(dot)com> wrote:
> >>
> >> On 11 May 2011 14:28, Michael Wood <esiotrot(at)gmail(dot)com> wrote:
> >> > 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.)
> >>
> >> Sorry, should be:
> >>
> >> ...
> >> ESCAPE E'\\'
> >>
> >> if you want to use a single \ as an escape character.
>
> --
> Michael Wood <esiotrot(at)gmail(dot)com>
>

In response to

pgsql-novice by date

Next:From: Birchall, AustenDate: 2011-05-12 08:32:25
Subject: WAL logs - do they operate at a database or cluster level?
Previous:From: Michael WoodDate: 2011-05-11 13:42:21
Subject: Re: Error in using copy command

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group