Postgresql 8.47.on Debian/ Gnu Squeeze-stable. Imporitng data
I imported one table from a csv file format with no problems.
The file fields where matching my table fields.
*** For a second table import (I will use a similar example to simplify:
--- So I created a table with the following fields:
Contactname addr city zipcode
the file to import has the following fields
Contactname firstname middlename lastname addr city zipcode.
Is there a way to import the file by listing the columns
I tried :
copy MyTableName column(contactname,,,,addr,city,zipcode) from 'pathtomycsvfile' with null as '' csv header quote as '"' escape as '"' ;
The error is always pointing to the 'c' of column I tried to remove the parenthesis I removed the statement 'column' and other scenarios
It Didn't work.
Does that mean that I will absolutely have to remove those unwanted columns from the import file. I have about 120 of those files to import.
If I can avoid to do the later what would be the right statement.
There are two problems here:
a) You're using a column keyword that doesn't exist; what you'd want
to do normally is:
be matched in your table structure. Look at PGLoader, or sanitise
your data ...
|All times are GMT -5. The time now is 01:16 PM.|