X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 284EFD6DAB for ; Mon, 17 Oct 2005 11:02:50 -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 97980-04 for ; Mon, 17 Oct 2005 14:02:41 +0000 (GMT) Received: from mallaury.nerim.net (smtp-101-monday.noc.nerim.net [62.4.17.101]) by svr1.postgresql.org (Postfix) with ESMTP id DBAF6D7065 for ; Mon, 17 Oct 2005 11:02:43 -0300 (ADT) Received: from jobmare.clarisys.lan (claridsl512.net1.nerim.net [213.41.148.137]) by mallaury.nerim.net (Postfix) with ESMTP id 8A0BE4F407; Mon, 17 Oct 2005 16:02:38 +0200 (CEST) Received: from day by jobmare.clarisys.lan with local (Exim 4.52) id 1ERVaJ-0006cK-2Z; Mon, 17 Oct 2005 16:03:27 +0200 Date: Mon, 17 Oct 2005 16:03:27 +0200 From: David Pradier To: Russell Simpkins Cc: pgsql-sql@postgresql.org Subject: Re: Design problem : using the same primary keys for inherited objects. Message-ID: <20051017140327.GE19930@clarisys.fr> References: <20051014124334.GC19930@clarisys.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 required=5 tests=[AWL=-0.000, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/182 X-Sequence-Number: 23035 > That is perfectly valid. Only, I would argue that an actor is a person. Oups, i really made a vocabulary mistake here. Let me paste what i wrote some minutes earlier to Daryl : ---- By 'actor', I meant "somebody who does something". Lots of tables inherits from 'actor' in our current design, each of these being a "job" : laboratory, delivering company, person, etc... Furthermore, 'person' inherits from 'actor' and some other tables inherits from 'person' : user, physician, customer, etc... ---- > What I was offering was dealing with issues where more then one actor could > be the same person. Given your design, a person could only be one actor. If > that is true, no more discussion is needed. If that is not true, then one > way to deal with that is to make compound primary keys in your actor table. > table person ( > person_id serial primary key, > name varchar(20)); > table actor( > person_id foreign key references person, > role varchar(20), > primary key ( person_id, role ) > ); > would then allow a person to be more then on actor based on role. It is specified that not two laboratories could be the same actor, for example. That's why i think having a primary key referencing another primary key could technically work, but well, it seems to me BAD to mix two primary keys together. I'm still wondering... -- David Pradier -- Directeur Technique de Clarisys Informatique -- Chef de projet logiciels libres / open-source