Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C99859F9AC0 for ; Tue, 28 Aug 2007 10:26:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 61621-04-2 for ; Tue, 28 Aug 2007 10:26:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from main2.mycybernet.net (main2.mycybernet.net [209.222.63.140]) by postgresql.org (Postfix) with ESMTP id 268E89F9944 for ; Tue, 28 Aug 2007 10:26:10 -0300 (ADT) Received: from 227-54-222-209.mycybernet.net ([209.222.54.227] helo=phlogiston.dydns.org) by main2.mycybernet.net with esmtp (Exim 4.62) (envelope-from ) id 1IQ157-00075r-QG for pgsql-sql@postgresql.org; Tue, 28 Aug 2007 09:26:09 -0400 Received: by phlogiston.dydns.org (Postfix, from userid 1000) id 74A2B3FAF; Tue, 28 Aug 2007 09:26:04 -0400 (EDT) Date: Tue, 28 Aug 2007 09:26:04 -0400 From: Andrew Sullivan To: pgsql-sql@postgresql.org Subject: Re: Database normalization Message-ID: <20070828132604.GB461@phlogiston.dyndns.org> References: <99b656cb0708210709j5182b73cna63a2d275efa0e84@mail.gmail.com> <99b656cb0708280447x4eb7c45axec01c8d0ebc6c82d@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <99b656cb0708280447x4eb7c45axec01c8d0ebc6c82d@mail.gmail.com> User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/238 X-Sequence-Number: 29176 On Tue, Aug 28, 2007 at 12:47:45PM +0100, Sebastian Ritter wrote: > > The update/message format is exactly the same for both. Should I make two > > different tables: > > one table with extra columns : is_client, client_id, service_id, where > > either client_id or service_id would be null depending on the is_client > > boolean? Is the rest of the data the same? If so, then one table is right. If not, then more than one table. In either case, I really hate the idea of two columns, one of which is always null. But if you're going to do that, make sure you add a CHECK constraint where !(col1 IS NULL and col2 IS NULL). A -- Andrew Sullivan | ajs@crankycanuck.ca I remember when computers were frustrating because they *did* exactly what you told them to. That actually seems sort of quaint now. --J.D. Baldwin