Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1590F632202 for ; Wed, 10 Feb 2010 13:29:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 64883-03 for ; Wed, 10 Feb 2010 17:29:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sargon.lncsa.com (mail.lncsa.com [213.215.28.11]) by mail.postgresql.org (Postfix) with ESMTP id 999226328D8 for ; Wed, 10 Feb 2010 13:29:44 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by sargon.lncsa.com (Postfix) with ESMTP id 081BF300DF03 for ; Wed, 10 Feb 2010 18:29:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lncsa.com Received: from sargon.lncsa.com ([127.0.0.1]) by localhost (sargon.lncsa.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b9V440RWfzj2 for ; Wed, 10 Feb 2010 18:29:42 +0100 (CET) Received: from zenon.apartia.fr (zenon.apartia.fr [10.0.3.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zenon.apartia.fr", Issuer "ca.apartia.fr" (verified OK)) by sargon.lncsa.com (Postfix) with ESMTP id D94FD300E022 for ; Wed, 10 Feb 2010 18:29:42 +0100 (CET) Received: from galba.apartia.fr (galba.apartia.fr [10.0.3.119]) by zenon.apartia.fr (Postfix) with ESMTP id 7E3DC5899F828 for ; Wed, 10 Feb 2010 18:29:42 +0100 (CET) Received: by galba.apartia.fr (Postfix, from userid 1000) id 556D41F4BF; Wed, 10 Feb 2010 18:29:42 +0100 (CET) Date: Wed, 10 Feb 2010 18:29:42 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: Re: 'image' table with relationships to different objects Message-ID: <20100210172942.GA10086@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org References: <20100209074909.GA11838@apartia.fr> <4B714E12.1090207@archonet.com> <4B7178CF.60502@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B7178CF.60502@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/39 X-Sequence-Number: 33638 On Tue, Feb 09, 2010 at 08:01:35AM -0700, Rob Sargent wrote: > You can also invert this, making all the image owner share a common base > table and then images are dependent on that base > > base (id, type) where type is an enumeration or some such > person (id, name, etc) where id is FK to base id > locations (id, address, etc) where id is FK to base.id > events(id, date, etc) where id is FK to base.id > images(id, baseid) where baseid is FK to base.id > > views across base to the "data" tables for easier sql if desired > ORM: person location and event would inherit from base This is intriguing. How do I manage the auto-incrementing 'id' serial on children tables 'person', 'location' and 'event'? Thanks, -- http://www.critikart.net