Re: help with COPY from .csv file into database - Mailing list pgsql-novice

From michael@floog.net
Subject Re: help with COPY from .csv file into database
Date
Msg-id 1091633354.411100caaff91@webmail.floog.net
Whole thread Raw
In response to Re: help with COPY from .csv file into database  (michael@floog.net)
Responses Re: help with COPY from .csv file into database
List pgsql-novice
I have tried again to copy using a suggestion sent to me from another
new user on the list:

Attempt 1 --

TEST_DB=# copy matters from '/home/floog/TEST_DB.csv' delimiter ',';
ERROR:  could not open file "/home/floog/TEST_DB.csv" for reading:
Permission denied

Okay, so I chmod the file to be read/write by anyone -- (chmod 0777
/home/floog/TEST_DB.csv)

TEST_DB=# copy matters from '/home/floog/TEST_DB.csv' delimiter ',';
ERROR:  could not open file "/home/floog/TEST_DB.csv" for reading:
Permission denied

Still no go so I copied the file into my PGDATA directory -
/usr/local/postgres

TEST_DB=# copy matters from '/usr/local/postgres/TEST_DB.csv' delimiter
',';
ERROR:  invalid input syntax for integer: ""CFW""
CONTEXT:  COPY matters, line 1, column matter_num: ""CFW""
TEST_DB=# select * from matters;
 client_1_lastname | client_1_firstname | client_1_address |
client_1_phone | client_2_lastname | client_2_firstname |
client_2_address | client_2_phone | carrier_name | claim_rep |
claim_num | responsible | supervisory | second | client_num |
matter_num | file_name | adverse_1_lastname | adverse_1_firstname |
adverse_2_lastname | adverse_2_firstname | adverse_3_lastname |
adverse_3_firstname | other_party_lastname | other_party_firstname |
case_type | billing_type | date_of_loss | judicial_district | date_open
| date_close
-------------------+--------------------+------------------+----------------
+-------------------+--------------------+------------------+--------------
--+--------------+-----------+-----------+-------------+-------------+-
-------+------------+------------+-----------+--------------------+----
-----------------+--------------------+---------------------+---------
-----------+---------------------+----------------------+------------
-----------+-----------+--------------+--------------+---------------
----+-----------+------------
(0 rows)

TEST_DB=#

I understand the first error about the "CFW" being in a field designated
in an integer format.  That's okay.  CFW are the initials of a person
at my office and that's just a data entry error -- wrong data in the
wrong column.

But I don't understand why none of the data from the .csv file was
copied to the database.  SELECT * FROM matters - results in nothing but
a line of hyphens.

Yikes, I can't get off the ground.  I can't imagine manually inserting 2
megs. of stuff one entry at a time.  Please help if you can.

I appreciate your time and patience.

Regards,

Mike



pgsql-novice by date:

Previous
From: michael@floog.net
Date:
Subject: Re: help with COPY from .csv file into database
Next
From: Oliver Elphick
Date:
Subject: Re: help with COPY from .csv file into database