Re: Duplicate information in parent and child tables

Поиск
Список
Период
Сортировка
От Chetan Suttraway
Тема Re: Duplicate information in parent and child tables
Дата
Msg-id CAPtHcnFVbyRR_qi2rhcMbe8rAfD1sK5Y=RcSB88JuR7sxzAt8g@mail.gmail.com
обсуждение исходный текст
Ответ на Duplicate information in parent and child tables  (JORGE MALDONADO <jorgemal1960@gmail.com>)
Список pgsql-novice


On Tue, Jan 10, 2012 at 1:42 AM, JORGE MALDONADO <jorgemal1960@gmail.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

EnterpriseDB Blog : http://blogs.enterprisedb.com




В списке pgsql-novice по дате отправления:

Предыдущее
От: JORGE MALDONADO
Дата:
Сообщение: HTML encode/decode
Следующее
От: Chetan Suttraway
Дата:
Сообщение: Re: Partitioning: avoid insert in master table