From: Rob Sargent <robjsargent@gmail.com>
To: Gary Chambers <gwchamb@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Duplicates Processing
Date: Fri, 08 Oct 2010 15:34:28 -0600
Message-ID: <4CAF8E64.8010000@gmail.com> (raw)
In-Reply-To: <AANLkTimRfzKH0DhyuMLpeU3g5GnCU6CuzYdxcph5HjqL@mail.gmail.com>
References: <AANLkTinSF+zqTVHbHp5HgN0TwHX-DjLAwQ4LhE7FYFxZ@mail.gmail.com>
<m3iq1cr0fi.fsf@passepartout.tim-landscheidt.de>
<AANLkTinr=cNsOeMGfOAjg5ncWhQ9p4RbpfyaoV1YN66T@mail.gmail.com>
<4CAF79EB.1080606@gmail.com>
<AANLkTimRfzKH0DhyuMLpeU3g5GnCU6CuzYdxcph5HjqL@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: robjsargent@gmail.com, gwchamb@gmail.com
Subject: Re: Duplicates Processing
In-Reply-To: <4CAF8E64.8010000@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox