Inheritance of Ref Integ
От | |
---|---|
Тема | Inheritance of Ref Integ |
Дата | |
Msg-id | 000001bfe2b1$a23d7a50$14da7fa5@alfa_romeo.defenders.state.co.us обсуждение исходный текст |
Список | pgsql-general |
I have playing around with the new foreign key feature and found a problem that I could not solve effectively: I have a table called request that contains basic expense request data. Four other tables 101_request, 102_request, 103_request and 104_request are subclasses of the request table and add different data fields to the basic request. Another table payment contains payment information for all requests. It contains the request id as a foreign key. I would like to use the foreign key contraint on it, but have not been able to figure out how or if you can and get the child tables to inherit it. I tried the following which does not work (among others): CREATE TABLE payment ( id SERIAL PRIMARY KEY, req_id INT4 NOT NULL REFERENCES request*(id) ON DELETE CASCADE, date DATE NOT NULL, amount MONEY NOT NULL, note TEXT ); Doing a reference to request alone does not pass the reference down to the child tables. Is it even possible to do what I want? I know I could just divide this up into separate tables to make it work, but using inheritance seemed like a *cleaner* method in my mind. Any insights are appreciated. -Casey Duncan
В списке pgsql-general по дате отправления: