Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id AB05E635A7A for ; Thu, 11 Feb 2010 07:07:30 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 93491-02-5 for ; Thu, 11 Feb 2010 11:07:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ananke.wxnz.net (ananke.wxnz.net [58.28.4.122]) by mail.postgresql.org (Postfix) with ESMTP id B7E0F633F8E for ; Thu, 11 Feb 2010 07:05:45 -0400 (AST) Received: from gonzo (ip-118-90-128-91.xdsl.xnet.co.nz [118.90.128.91]) by ananke.wxnz.net (Postfix) with ESMTP id DF49D1708AE for ; Fri, 12 Feb 2010 00:05:39 +1300 (NZDT) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1NfWra-0005zx-KV for pgsql-sql@postgresql.org; Fri, 12 Feb 2010 00:05:38 +1300 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: 'image' table with relationships to different objects Date: 11 Feb 2010 11:05:38 GMT Organization: Dis (not Dat) Organisation Lines: 19 Message-ID: References: <20100209074909.GA11838@apartia.fr> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1265886338 21552 127.0.0.1 (11 Feb 2010 11:05:38 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.313 tagged_above=-10 required=5 tests=AWL=-0.314, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201002/42 X-Sequence-Number: 33641 On 2010-02-09, Louis-David Mitterrand wrote: > Hello, > > In my database I have different object types (person, location, event, > etc.) all of which can have several images attached. can one image be several people? can one image be both event and location? > What is the best way to manage a single 'image' table with relationships > to (potentially) many different object types while keeping referrential > integrity (foreign keys)? probably several join tables image_location image_person image_event with uniques and cascades where needed.