Re: Error Importing CSV File

From: Bryan Nelson <shrek(at)shreks-place(dot)com>
To: Susan Cassidy <scassidy(at)edgewave(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Error Importing CSV File
Date: 2011-07-15 16:56:42
Message-ID: CAF9KfT8KrMUMOrNTAt_+WoXdkNK94U0pEb=3ONVtkAxDVNzz7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Susan, I have tried importing the file both with and without "'s
around each field. But for some reason it still always chokes on the
first one.

On Fri, Jul 15, 2011 at 12:30 PM, Susan Cassidy <scassidy(at)edgewave(dot)com> wrote:
> The default quote character is ", so I believe it is expecting quotes to be around text fields.  That is the norm for CSV files.
>
> Susan
>
> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Bryan Nelson
> Sent: Friday, July 15, 2011 9:04 AM
> To: pgsql-general(at)postgresql(dot)org
> Subject: [GENERAL] Error Importing CSV File
>
> 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
>
> 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".
>
> Any and all help greatly appreciated!
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Susan Cassidy 2011-07-15 17:10:27 Re: Error Importing CSV File
Previous Message Bryan Nelson 2011-07-15 16:55:20 Re: Error Importing CSV File