Integrity reference and inheritance

Поиск
Список
Период
Сортировка
От Christophe Labouisse
Тема Integrity reference and inheritance
Дата
Msg-id m2n17h7x0g.fsf@gabuzo.meunet
обсуждение исходный текст
Ответы Re: Integrity reference and inheritance  (Christophe Labouisse <labouiss@cybercable.fr>)
Список pgsql-sql
I wanted to build the following schema :

- one "generic" document table with a column doc_id ;
- a couple of "specific" document tables inheriting from doc ;
- a table refering a document by it's id with and integrity constraint
on it.

In SQL :

CREATE TABLE doc (doc_id serial PRIMARY KEY,
);

CREATE TABLE lexique (
) INHERITS (doc);

CREATE TABLE word_doc (id serial PRIMARY KEY,doc_id int4 NOT NULL CONSTRAINT word_doc_doc_id_ref REFERENCES doc ON
DELETECASCADE,
 
);


What I tried to do next is to insert a new "lexique" entry, and then a
bunch of "word_doc" rows refering this entry. The last part fails with
a constraint violation this is quite normal since the trigger in
backend/utils/adt/ri_triggers.c makes a "SELECT FROM ONLY".

What should I do ? Should I consider another way to do what I want,
rewrite a trigger to replace the system one ?


-- 
Le cinéma en Lumière : http://www.lumiere.org/
Fingerprint : 4721 651D D309 B302 93E4  5D73 CC52 DF3A E7C7 86CF


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

Предыдущее
От: Gerald Gutierrez
Дата:
Сообщение: Getting row with id=max(id)
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: behavior of ' = NULL' vs. MySQL vs. Standards