From: | Bryan Nelson <shrek(at)shreks-place(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Error Importing CSV File |
Date: | 2011-07-15 17:57:03 |
Message-ID: | CAF9KfT_4ERdcY0vv6BS+STaweqy7xjsV5Hfk3+VeK7R-52Lwpw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom, rake is a rails command, also after doing a \d geo_data it does
show that it's adding an id column before everything else. I'm
guessing my best bet is going to be creating the table by hand as I
have no idea how to tell it not to create the extra field. Thanks for
the help everyone, figured it had to be something simple. Shows how
new I am at postgres.
On Fri, Jul 15, 2011 at 1:44 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bryan Nelson <shrek(at)shreks-place(dot)com> writes:
>> Tom, the file was created in linunx and is utf-8. Here is the rake
>> task that created the table:
>
>> class CreateGeoData < ActiveRecord::Migration
>> def self.up
>> create_table :geo_data do |t|
>> t.column :zip_code, :text
>> t.column :latitude, :float8
>> t.column :longitude, :float8
>> t.column :city, :text
>> t.column :state, :text
>> t.column :county, :text
>> end
>> add_index "geo_data", ["zip_code"], :name => "zip_code_optimization"
>> end
>
> Never heard of rake before, but I'm betting that it's doing stuff
> behind your back, like including an "id" column in the table definition.
> Try looking at the table in psql (\d geo_data), or enabling query
> logging on the server so you can see what the actual CREATE TABLE
> command sent to the server looks like.
>
> If there is an extra column or two in the table definition, you'll need
> to put a column list into the COPY command, or else include values for
> the added column(s) into the CSV file.
>
> And I'm still thinking there are invisible characters in that first
> line... if you can't avoid that, you might add a dummy header line
> and use COPY's HEADER option to ignore the first line.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2011-07-15 17:57:51 | Re: Error Importing CSV File |
Previous Message | Scott Ribe | 2011-07-15 17:54:24 | Re: Error Importing CSV File |