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 5BC93D8AFE for ; Tue, 20 Sep 2005 07:07:39 -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 98120-09 for ; Tue, 20 Sep 2005 10:07:33 +0000 (GMT) Received: from mx.laposte.net (mx.laposte.net [80.245.62.11]) by svr1.postgresql.org (Postfix) with ESMTP id C60DED7E7A for ; Tue, 20 Sep 2005 07:07:32 -0300 (ADT) Received: from smtp.laposte.net (10.150.9.37) by mx.laposte.net (7.2.060.1) id 42F8D2C2016D9E04; Tue, 20 Sep 2005 12:07:32 +0200 Received: from laposte.net (10.150.9.79) by smtp.laposte.net (7.2.056.5) id 4329EA7200378808; Tue, 20 Sep 2005 12:07:32 +0200 Date: Tue, 20 Sep 2005 12:07:32 +0200 Message-Id: Subject: Re: Inheritance (general hints wanted) MIME-Version: 1.0 X-Sensitivity: 3 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable From: "thomas.silvi" To: "achill" Cc: "pgsql-sql" X-XaM3-API-Version: 4.1 (B103) X-SenderIP: 127.0.0.1 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 required=5 tests=[none] X-Spam-Level: X-Archive-Number: 200509/175 X-Sequence-Number: 22722 Hi, I am not an expert but in object conception, a design pattern exists for the case you describe. I don't remember which one. The idea is to add an attribute that references the job of the employee. The inheritance is not on the side of the employee but on the side of the job. So if the job of the employee changes, it easy to do it. an example in pseudo-code class basic_job string name class sailor_job inherit basic_job class employee string name basic_job job Hope it helps, Regards, Thomas > > Hi, > > I think i have reached a point in my PgSQL years > that i am seriously thinking of using inheritance. > > The situation is simple: An new entity (tanker vessels crew) > is about to be modeled, and i suspect > there will be a future need to include > the rest of 'workers' besides 'sailors', > IOW i suspect a future need to generalize. > > So i am thinking of a two-level tree hierarchy, > where there is a simple table emp (employee), > and a direct child 'tankerscrew'. Later > there may be 'masons', 'office_employees' > and so on. > > The problem is that while i find this approach > attractive, i have never used PostgreSQL > inheritance exhaustively and in production scale. > > Furthermore, i also feel that not many > people have used inheritance in a massive fashion > (besides playing with a test db). > > Of course i can do it with separate uncoupled tables, > that can be later related with some views. > > So that leads to the final question: > -What are the main PROs of inheritance that cant be beat > by other solutions, and > -Are there any traps someone must have in mind when he > prepares for such a design? > > Thanx in advance. > -- > -Achilleus > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > A+ Tom=0A=0AAcc=E9dez au courrier =E9lectronique de La Poste : www.lapos= te.net ; =0A3615 LAPOSTENET (0,34=80/mn) ; t=E9l : 08 92 68 13 50 (0,34=80= /mn)=0A=0A