X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 84AA19FAE4E for ; Fri, 7 Jul 2006 08:33:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57345-03 for ; Fri, 7 Jul 2006 08:33:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from druid.net (druid.net [66.96.28.249]) by postgresql.org (Postfix) with ESMTP id 5F4FD9FA999 for ; Fri, 7 Jul 2006 08:33:26 -0300 (ADT) Received: from dilbert (H245.C18.B96.tor.eicat.ca [66.96.18.245]) by druid.net (Postfix) with SMTP id E6CA5B557; Fri, 7 Jul 2006 07:33:25 -0400 (EDT) Date: Fri, 7 Jul 2006 07:33:25 -0400 From: "D'Arcy J.M. Cain" To: "David Clarke" Cc: pgsql-sql@postgresql.org Subject: Re: Alternative to serial primary key Message-Id: <20060707073325.926f601f.darcy@druid.net> In-Reply-To: <12b7ac1e0607070037p4c2a94d4r8e6758be7b08ca95@mail.gmail.com> References: <20060706183920.46008.qmail@web33314.mail.mud.yahoo.com> <12b7ac1e0607061330o34adbd6ds9bd624d3889c7fe7@mail.gmail.com> <20060706171816.9f248316.darcy@druid.net> <12b7ac1e0607070037p4c2a94d4r8e6758be7b08ca95@mail.gmail.com> X-Mailer: Sylpheed version 2.2.6 (GTK+ 2.8.18; i386--netbsdelf) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/90 X-Sequence-Number: 25664 On Fri, 7 Jul 2006 19:37:15 +1200 "David Clarke" wrote: > > And even given all of that, I would probably still use serial. > Because? Simplicity. Cleanliness. > > Danger, Will Robinson. The phrase "regenerate my primary key" > > immediately raises the hairs on the back of my neck. If the primary > > key can ever change, you have a broken schema. > > Perhaps my choice of words was somewhat hasty. A serial is totally > divorced from the data it represents whereas a md5 hash is (for my > purposes) unique, stable, verifiable, and simple. It's not that I think that the primary key should never have meaning in the database (I use the two letter country code as the PK in my country table for example) I just think that it's dangerous ground and should be tread very carefully. However, I join others in applauding you for your efforts to investigate this so deeply. You may wind up coming out of this with something interesting, even if it isn't what you went in looking for. -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.