| От | brian |
|---|---|
| Тема | Re: Foreign keys to inherited tables |
| Дата | |
| Msg-id | 47E1DD2B.70207@zijn-digital.com обсуждение исходный текст |
| Ответ на | Foreign keys to inherited tables ("Leon Mergen" <leon@solatis.com>) |
| Ответы |
Re: Foreign keys to inherited tables
|
| Список | pgsql-general |
Leon Mergen wrote:
> Hello,
>
> I was wondering, I'm reading that there is no support for foreign keys
> to inherited (child) tables -- are there any plans on supporting these
> in the (near) future, and/or are there any practical workarounds for
> this ?
>
This has worked well for me:
CREATE TABLE child_table (
...
) INHERITS (parent_table);
ALTER TABLE child_table ALTER COLUMN id SET DEFAULT
nextval('parent_table_id_seq');
CREATE UNIQUE INDEX child_table_pk ON child_table (id);
Note that it's not necessary to declare an id column for the child.
b
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера