X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7151D5E46C1 for ; Sat, 7 Aug 2004 22:06:44 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83590-07 for ; Sun, 8 Aug 2004 01:06:43 +0000 (GMT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by svr1.postgresql.org (Postfix) with ESMTP id 9028E5E46C5 for ; Sat, 7 Aug 2004 22:06:39 -0300 (ADT) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 1Btc96-0006tR-0X; Sun, 08 Aug 2004 01:06:44 +0000 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.34) id 1Btc8y-0006q1-Sq; Sun, 08 Aug 2004 02:06:36 +0100 Subject: Re: surrogate key or not? From: Oliver Elphick Reply-To: olly@lfix.co.uk To: Kenneth Gonsalves Cc: pgsql-sql@postgresql.org In-Reply-To: <0408070930300J.01190@thenilgiris.com> References: <1090325769.3241.27.camel@dicaprio.akademie1.de> <41026D55.3040002@zara.6.isreserved.com> <200408061542.04336.josh@agliodbs.com> <0408070930300J.01190@thenilgiris.com> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1091927196.13140.174.camel@linda> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 08 Aug 2004 02:06:36 +0100 Content-Transfer-Encoding: 7bit X-LFIX-MailScanner: Found to be clean X-MailScanner-From: olly@lfix.co.uk X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/49 X-Sequence-Number: 18546 On Sat, 2004-08-07 at 05:00, Kenneth Gonsalves wrote: > why shouldnt the primary key change? the only key that should never change is > a key that is used as a foreign key in another table. In a table like this: > > id serial unique > name varchar primary key > > name may change - id will never change. id is used as the foreign key It can change if you use ON UPDATE CASCADE in the foreign key definitions. -- Oliver Elphick olly@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA ======================================== "Be still before the LORD and wait patiently for him; do not fret when men succeed in their ways, when they carry out their wicked schemes." Psalms 37:7