Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 140B31337B51 for ; Fri, 8 Oct 2010 18:34:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 79014-04 for ; Fri, 8 Oct 2010 21:34:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) by mail.postgresql.org (Postfix) with ESMTP id 80A12133798F for ; Fri, 8 Oct 2010 18:34:48 -0300 (ADT) Received: from in02.mta.xmission.com ([166.70.13.52]) by out02.mta.xmission.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1P4KaV-0000NJ-4v; Fri, 08 Oct 2010 15:34:47 -0600 Received: from [208.187.158.94] (helo=[172.16.1.223]) by in02.mta.xmission.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1P4KaJ-0000bx-NN; Fri, 08 Oct 2010 15:34:47 -0600 Message-ID: <4CAF8E64.8010000@gmail.com> Date: Fri, 08 Oct 2010 15:34:28 -0600 From: Rob Sargent User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Lightning/1.0b1 Thunderbird/3.0.6 MIME-Version: 1.0 To: Gary Chambers CC: pgsql-sql@postgresql.org References: <4CAF79EB.1080606@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-XM-SPF: eid=; ; ; mid=; ; ; hst=in02.mta.xmission.com; ; ; ip=208.187.158.94; ; ; frm=robjsargent@gmail.com; ; ; spf=neutral X-SA-Exim-Connect-IP: 208.187.158.94 X-SA-Exim-Mail-From: robjsargent@gmail.com X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Gary Chambers X-Spam-Relay-Country: Subject: Re: Duplicates Processing X-SA-Exim-Version: 4.2.1 (built Fri, 06 Aug 2010 16:31:04 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201010/23 X-Sequence-Number: 34674 Yes. With this you can find all part numbers/supplies which match your value, wattage criteria in one table. Or exclude any which have a non-null is_replacement_for value. If you need to drop the "replaceable" variant, you choose which of the replacements to promote and update the others to match the new "replaceable". They're all instances of the same type of thing so in my view they ought to live in the same table. Also possible to maintain the replacement structure via a (self) join record with replacable/is_replacement_for tuples. You have a similar but slightly more involve maintenance issue of course. On 10/08/2010 02:42 PM, Gary Chambers wrote: > Rob, > >> Perhaps a trade off between nullable fields and redundant types. If >> your original table simply had a nullable column called >> isReplacementFor, into which you place in the subsequent rows the id of >> the first instance found. > > Am I misunderstanding you when you're suggesting a table like: > > part_number INTEGER > is_replacement_for INTEGER references part_number > value INTEGER > wattage FLOAT8 > ... > > -- Gary Chambers