Re: Error Importing CSV File

From: Bryan Nelson <shrek(at)shreks-place(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error Importing CSV File
Date: 2011-07-15 16:55:20
Message-ID: CAF9KfT9pgwyY6hA17JPnZOZH6isRwnF8g-9_bdFwLyRPZij_mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Adrian, yes that is the entire table definition.

On Fri, Jul 15, 2011 at 12:30 PM, Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> wrote:
> On 07/15/2011 09:03 AM, Bryan Nelson wrote:
>>
>> I am having problems importing a CSV file of sample data for testing
>> in a web app.
>>
>> Columns&  Types
>> -------------------
>> zip_code - text
>> lattitude - float8
>> longitude - float8
>> city - text
>> state - text
>> county - text
>
> Is this the complete table description?
>
>>
>> Some Sample Data From CSV File
>> ------------------------------
>> 96799,-7.209975,-170.7716,PAGO PAGO,AS,AMERICAN SAMOA
>> 96941,7.138297,151.503116,POHNPEI,FM,FEDERATED STATES OF MICRO
>> 96942,7.138297,151.503116,CHUUK,FM,FEDERATED STATES OF MICRO
>>
>> COPY Command
>> ------------
>> COPY geo_data FROM 'geo_data2.csv' DELIMITERS ',' CSV;
>>
>> Error Message
>> -------------
>> ERROR: invalid input syntax for integer: "96799"
>> CONTEXT: COPY geo_data, line 1, column id: "96799"
>>
>> I can't figure out why it keeps choking with "invalid syntax for
>> integer" since the field was created as "text".
>
> My guess, there is a auto-increment field in front of the fields you show
> above.
>
>>
>> Any and all help greatly appreciated!
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bryan Nelson 2011-07-15 16:56:42 Re: Error Importing CSV File
Previous Message Susan Cassidy 2011-07-15 16:30:49 Re: Error Importing CSV File