Re: Duplicates Processing

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Gary Chambers <gwchamb(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Duplicates Processing
Date: 2010-10-08 21:34:28
Message-ID: 4CAF8E64.8010000@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message James Cloos 2010-10-08 22:02:26 counting related rows
Previous Message Gary Chambers 2010-10-08 20:42:29 Re: Duplicates Processing