primary keys

From: Grant Maxwell <grant(dot)maxwell(at)maxan(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: primary keys
Date: 2009-09-12 16:35:02
Message-ID: F981E855-9C54-491F-B702-3EDFFBB79C63@maxan.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Folks

I'm looking for a bit of advice regarding alpha primary keys.

I have a table (designed by someone else) that has a numeric primary
key and also a unique non-null email address field.

The use of the primary key is causing me some headaches in that in
multiple database server environment each server allocates a unique
number from a range
(and that works fine) but when the table is replicated (master-master-
master) the exception handling is a bit tricky because each database
server may have
records that are duplicate at the email address field - with a
different primary key number.

I don't know why it was done this way but it seems to me that the
email addresses are unique, non null and could be used as the primary
key. This would make the
replication much faster and simpler.

Does anyone out there think the change (number to email address as
primary key) would be a bad idea ?

your thoughts would be appreciated.

regards
Grant

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Denis BUCHER 2009-09-12 16:44:50 Re: How to GRANT rights to modify a table ???
Previous Message Tom Lane 2009-09-12 16:00:36 Re: How to GRANT rights to modify a table ???