Обсуждение: Unique indices and inheritance

Поиск
Список
Период
Сортировка

Unique indices and inheritance

От
Bruce Guenter
Дата:
Greetings.

In the following situation:
    create table foo (id int4);
    create table bar (val int4) inherits(foo);
Is it possible to create a unique index such that no record in either
foo or bar (in other words, in foo*) has a duplicated id?  I tried what
seemed to be most obvious to me by doing:
    create unique index foo_pkey on foo*(id);
but it caused a syntax error.  Creating a unique index on just foo
allows duplicates between the two tables.
--
Bruce Guenter, QCC Communications Corp.  EMail: bruce.guenter@qcc.sk.ca
Phone: (306)249-0220               WWW: http://www.qcc.sk.ca/~bguenter/