Re: Multiple Inheritance
От | Tom Lane |
---|---|
Тема | Re: Multiple Inheritance |
Дата | |
Msg-id | 2681.974218714@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Multiple Inheritance (Wouter Tijhuis <tijhuis@cs.utwente.nl>) |
Список | pgsql-general |
Wouter Tijhuis <tijhuis@cs.utwente.nl> writes: > As you can see from the output this will generate a sequence error in test2. Well, since you have columns named "id" in *both* parent tables, it's not possible for the child to inherit both. The implementation is to ignore test2's id and inherit only test1's. Thus, you get an id sequence that is unique across test1 and test, but has nothing to do with test2's id sequence. If you want distinct ids for both test1 and test2, name the columns differently so that the child table can inherit both. Or, if you think that you want a globally unique id, make a common ancestor table that both test1 and test2 inherit id from. Or build the serial-number behavior from spare parts --- there's nothing magic about it, it's just "DEFAULT nextval('some-sequence')" --- so you can have direct control of which sequence generator gets used for each table. regards, tom lane
В списке pgsql-general по дате отправления: