COPY Question - Mailing list pgsql-general

From Samuel A. Mullen
Subject COPY Question
Date
Msg-id 390065EA.187361C3@oppunl.com
Whole thread Raw
Responses Re: COPY Question
List pgsql-general
I'm trying to load a table from a flat file using the copy command from
within PG.

Table:
+----------------------------------+----------------------------------+-------+
|              Field               |              Type                |
Length|
+----------------------------------+----------------------------------+-------+
| dup_id                           | int4 not null default nextval('"
|     4 |
| dup_group                        | int4
|     4 |
| company                          | varchar()
|     0 |
| matchcode                        | varchar()
|     0 |
| new_matchcode                    | varchar()
|     0 |
| gender                           | char()
|     1 |
| lastnm                           | varchar()
|     0 |
| firstnm                          | varchar()
|     0 |
| address                          | varchar()
|     0 |
| state                            | char()
|     2 |
| postal_code                      | varchar()
|     0 |
| life_paid                        | float4
|     4 |
| life_refund                      | float4
|     4 |
| ytd_paid                         | float4
|     4 |
+----------------------------------+----------------------------------+-------+
Index:    duplicates_pkey

Copy Command:
copy duplicates from '$SOME_DIRECTORY/cap_dups' using delimiters '|';

Example Record to be inserted:
|7984|cap|99830MTIN557|99830.PBKS557.MRMNT.MBRRST|M|ROBERTS|MATIN|PO BOX
557|AK|99830|0|0|0

Error:
ERROR:  Cannot insert a duplicate key into a unique index

As you can see I'm delimiting the fields with a '|' character.  You will
also notice that there is no field 1.  I was hoping that I could leave
that blank and the sequence automatically fill in the PKEY.  Does this
not work?

Any help to why this fail is appreciated.

Samuel Mullen
--
 _____________________
/   Samuel A. Mullen  \
|  Programmer Analyst  |_______________________________________________
|  Opportunities Unl.  | They also do no iniquity: they walk in his    \
\_____________________/| ways.                                         |
                       |                    Psalms 119:2               |
                       \_______________________________________________/

pgsql-general by date:

Previous
From: "Brett W. McCoy"
Date:
Subject: Re: PG Problems
Next
From: Bruce Momjian
Date:
Subject: Re: COPY Question