Re: unique across two tables

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: unique across two tables
Дата
Msg-id 021801cc30e1$2e8ed830$8bac8890$@yahoo.com
обсуждение исходный текст
Ответ на Re: unique across two tables  (Misa Simic <misa.simic@gmail.com>)
Ответы Re: unique across two tables
Re: unique across two tables
Список pgsql-general

Misa,

 

Your statement is utterly false simply by virtue of the documentation.

 

Inserts never propagate to other tables in a hierarchy

Indexes/Constraints only apply to individual tables

 

Since inserts do not propagate the base table never sees the records and thus the index on the base table cannot enforce uniqueness.

 

Other caveats and restrictions to the current inheritance implementation can be found in section 5.8 (Inheritance) of the documentation.  It is in the “Data Definition” chapter.

 

David J.

 

 

From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Misa Simic
Sent: Wednesday, June 22, 2011 8:49 AM
To: Tarlika Elisabeth Schmitz
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] unique across two tables

 

Hi Tarlika,

 

I think easy solution could be:

 

create baseTable with just one column as PK

 

TableA inhertis baseTable, it will have inherited Column + additianl tables for TableA

TableB inherits baseTable, it will aslo have inherited Column + additianl tables for TableB

 

Insert in any table TableA or TableB will automatically insert row in baseTable what will fail if value already exist...

 

 

 

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Streaming replication and temp table operations
Следующее
От: Misa Simic
Дата:
Сообщение: Re: unique across two tables