Re: Error Importing CSV File

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Error Importing CSV File
Дата
Msg-id 3936.1310751855@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Error Importing CSV File  (Bryan Nelson <shrek@shreks-place.com>)
Ответы Re: Error Importing CSV File  (Scott Ribe <scott_ribe@elevated-dev.com>)
Re: Error Importing CSV File  (Bryan Nelson <shrek@shreks-place.com>)
Список pgsql-general
Bryan Nelson <shrek@shreks-place.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

В списке pgsql-general по дате отправления:

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: Error Importing CSV File
Следующее
От: Steve Crawford
Дата:
Сообщение: Re: Error Importing CSV File