Re: command line v GUI and COPY

From: John Polo <polo(at)okstate(dot)edu>
To: jared <afonit(at)gmail(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: command line v GUI and COPY
Date: 2014-10-14 20:51:14
Message-ID: 543D8CC2.9090403@okstate.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Jared,
The error came up when I was trying to use pgadmin (GUI) and mouse and
menus that opened up with right-clicks. I opened psql and typed it all
as you did and it worked. Thank you. I have _many_ more CSVs and it
would easier to do this through a GUI or some other way that won't
involve as much typing. And that's just the FIA data I downloaded. I
have a bunch of GIS data that I want to start building another DB with.
But this is a start.

John

On 10/14/2014 2:03 PM, jared wrote:
>
>
> On Tue, Oct 14, 2014 at 2:40 PM, John Polo <polo(at)okstate(dot)edu
> <mailto:polo(at)okstate(dot)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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message jared 2014-10-14 21:05:29 Re: command line v GUI and COPY
Previous Message jared 2014-10-14 19:03:52 Re: command line v GUI and COPY