Re: command line v GUI and COPY - Mailing list pgsql-novice

From jared
Subject Re: command line v GUI and COPY
Date
Msg-id CADss3AQ2qLBaCiqXQ0gDdJx7HF_XNaXMe8gaOt68KPYHQDaZ1w@mail.gmail.com
Whole thread Raw
In response to Re: command line v GUI and COPY  (John Polo <polo@okstate.edu>)
Responses Re: command line v GUI and COPY  (John Polo <polo@okstate.edu>)
List pgsql-novice


On Tue, Oct 14, 2014 at 2:40 PM, John Polo <polo@okstate.edu> wrote:
 
This is how the data originally appears in the file. The error says it was in row 2. It looked like there was an extra pair of quotes and then an odd quote at the very end.
"CN","PLT_CN","INVYR","STATECD","UNITCD","COUNTYCD","PLOT","SUBP","SUBPTYP","BNDCHG","CONTRAST","AZMLEFT","AZMCORN","DISTCORN","AZMRIGHT","CYCLE","SUBCYCLE","CREATED_BY","CREATED_DATE","CREATED_IN_INSTANCE","MODIFIED_BY","MODIFIED_DATE","MODIFIED_IN_INSTANCE"
"202492243010854","157287634010478",2008,40,1,5,131,2,1,,2,276,0,,70,7,1,"",2011-05-02,"10854","",,""


John

Hey John,
Maybe I am misunderstanding, but that copied into a table fine, did you paste the correct row into the email?

I placed the text you provided than executed:


create table test
(
CN  character varying,
PLT_CN  character varying,
INVYR  character varying,
STATECD  character varying,
UNITCD  character varying,
COUNTYCD  character varying,
PLOT  character varying,
SUBP  character varying,
SUBPTYP  character varying,
BNDCHG  character varying,
CONTRAST  character varying,
AZMLEFT  character varying,
AZMCORN  character varying,
DISTCORN  character varying,
AZMRIGHT  character varying,
CYCLE  character varying,
SUBCYCLE  character varying,
CREATED_BY  character varying,
CREATED_DATE  date,
CREATED_IN_INSTANCE  character varying,
MODIFIED_BY  character varying,
MODIFIED_DATE  character varying,
MODIFIED_IN_INSTANCE  character varying
);

copy test
from '/for_import/test_data.txt'
with delimiter as ','
csv header
null as '';


And everything came through without errors.

pgsql-novice by date:

Previous
From: John Polo
Date:
Subject: Re: command line v GUI and COPY
Next
From: John Polo
Date:
Subject: Re: command line v GUI and COPY