> Currently I have a table on Microsoft Sequel Server that I wish to
> port over
> to Postgresql. This table has four primary keys and it's the
> of the four fields that make the record unique.
Just to get your terminology straight: What you have is a *single*
primary key, consisting of four fields. You cannot have more than one
primary key for a table. I would strongly suggest that you re-consider
your database design: composite primary keys (which is what you have)
are a *lot* of trouble.
A surrogate key (such as an auto-incrementing integer) would be much
easier to handle. For more information, I strongly reccomend the book
"Database Design for Mere Mortals."
> "Cannot insert a duplicate key into unique index attachments_pkey"
Yes. You have duplicate data somewhere in the table. The primary key
must be unique. Try this:
SELECT "docn","issue","docna","issuea", count(*) FROM attachments
GROUP BY "docn","issue","docna","issuea"
HAVING count(*) > 1;
This should list all of your duplicates. If you get a "NULL Value
Eliminated From Aggregate" warning, that means that one or more of
those columns has a NULL value, which must either be filled in, or you
must exclude it fromm the Primary Key.
In response to
pgsql-novice by date
|Next:||From: Josh Berkus||Date: 2002-04-18 16:06:59|
|Subject: Re: Multiple Primary Keys|
|Previous:||From: samsom, debra||Date: 2002-04-18 15:01:45|
|Subject: Multiple Primary Keys|