Re: Duplicate information in parent and child tables

From: Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Duplicate information in parent and child tables
Date: 2012-02-13 13:08:29
Message-ID: CAPtHcnFVbyRR_qi2rhcMbe8rAfD1sK5Y=RcSB88JuR7sxzAt8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Jan 10, 2012 at 1:42 AM, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>wrote:

> I have a parent table and a child table. In order to detect duplicate
> information I need to consider both tables. This means that a "duplicate
> record" consists of one parent record and one or more child records.
> Is there any standard approach to solve this issue?
>
>
>
You can create additional table that stores all record from parent as well
child.
For example, whenever a record is inserted in parent table, the same/copy
of record should
be inserted into this table. Then all you need is to put up constraints for
handling uniqueness.
Note that you would also need to handle updates,deletes so that we are not
left with any dangling records in additional table.

Note that there are others ways to handle the uniqueness in inheritance
setup.
you might want to take a look at all before coming up with the final
strategy.

Regards,
Chetan

--
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

Website: www.enterprisedb.com
EnterpriseDB Blog : http://blogs.enterprisedb.com
Follow us on Twitter : http://www.twitter.com/enterprisedb

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Chetan Suttraway 2012-02-13 13:12:16 Re: Partitioning: avoid insert in master table
Previous Message JORGE MALDONADO 2012-02-12 00:13:51 HTML encode/decode