X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1828ED1B52A for ; Wed, 7 Jan 2004 15:05:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 28075-06 for ; Wed, 7 Jan 2004 11:04:50 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 3C659D1B4E1 for ; Wed, 7 Jan 2004 11:04:46 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i07F4kU6037303 for ; Wed, 7 Jan 2004 15:04:46 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i07EjRvw025268 for pgsql-sql@postgresql.org; Wed, 7 Jan 2004 14:45:27 GMT From: "Loeke" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: question : the choice of the primary key. Date: Wed, 7 Jan 2004 15:17:55 +0100 Organization: KULeuvenNet Lines: 26 Message-ID: <1073485069.11869@seven.kulnet.kuleuven.ac.be> References: <1073432278.456150@seven.kulnet.kuleuven.ac.be> X-Complaints-To: abuse@belnet.be X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Cache-Post-Path: seven.kulnet.kuleuven.ac.be!unknown@10-4-148-255.kotnet.org X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.5 tagged_above=0.0 required=5.0 tests=BAYES_30, PRIORITY_NO_NAME, QUOTED_EMAIL_TEXT, REFERENCES, SEMIFORGED_HOTMAIL_RCVD X-Spam-Level: X-Archive-Number: 200401/56 X-Sequence-Number: 16449 > 1.many people make an extra id field and choose this id field to be the > p-key, > but then the same person can be present twice in the table (with different > id fields), the id in itself has no real meaning > 2.or u can choose the "natural" key for each person, lets say a name and the > birthdate of a person make that person unique, so lets make (the whole name > en the birthdate) the primary-key; but then if another table X wants to > refer this table of persons using a foreign key, this foreign key exists out > of 3 fields, which smells redundant i solved it for now using a p-key (the short id) and a a-key (the natural key), so integrity is ok and refences are short. > > u have often this choice in determining the primary keys, > > plz give me your opinions, options i overlooked or usefull comments. > >