help with COPY from .csv file into database

From: mike <michael(at)floog(dot)net>
To: PostGre <pgsql-novice(at)postgresql(dot)org>
Subject: help with COPY from .csv file into database
Date: 2004-08-03 12:15:02
Message-ID: 410F81C6.5060107@floog.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am getting started with Postgres and cannot copy a database that was
converted to a .csv file into my postgres database titled TEST_DB.

TEST_DB=> \d
List of relations
Schema | Name | Type | Owner
--------+---------+-------+-------
public | matters | table | floog
(1 row)

I have completed the copy command trying to move data from the .csv file
into TEST_DB like so:

COPY matters FROM /home/floog/TEST_DB.csv;

But I don't think the data transferred properly because when I try to
look at any column or row I get the following:

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)

I can open up and view the .csv file using an OpenOffice spreadsheet.
I'm thinking maybe I have to copy one column at a time from the .csv
file to the postgres database.
How do I copy something like column A, B, C, etc. from the .csv file to
TEST_DB client_1_lastname | client_1_firstname | client_1_address | etc.
etc.

Thank you for your time and patience.

Mike

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Rafael Charnovscki 2004-08-03 14:18:27 Re: inserting multiple rows
Previous Message Gaetano Mendola 2004-08-03 11:47:08 Re: Comparing database schema's