Re: Re(2): REFERENCES fails on derived classes

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Re(2): REFERENCES fails on derived classes
Дата
Msg-id Pine.BSF.4.21.0106110749570.47763-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re(2): REFERENCES fails on derived classes  ("Michael Caine" <mcaine@artlogic.com>)
Ответы Re(2): Re(2): REFERENCES fails on derived classes  ("Michael Caine" <mcaine@artlogic.com>)
Список pgsql-bugs
On Mon, 11 Jun 2001, Michael Caine wrote:

> a month i was told that my possible bug submission was "sort of" a bug.
> the report and reply are below.
>
> now i write a follow up because i don't know how to establish a workroom.
> specifically, i know know that a unique constraint must be added to an
> inherited "id" field, even if it's a primary key in the base table.  i can
> do this by 'CREATE INDEX', but this creates a completely new constraint.
> i want to share the unique 'serial' behavior between the base table and
> derived table, so that en entry in either table is unique between the
> tables.  that way, when i do a 'SELECT baseTable*' kind of command, i can
> differentiate between two records.  is there a way to do this, or could
> this be considered a valid bug of some sort?

Unfortunately there's no way within the current constraints to do that
kind of unique constraint, although you should get actually unique numbers
out of the serial -- and those will span the two tables since it uses the
same sequence, you can't guarantee that explicitly placed values will be
unique. This is probably a bug, but inheritance needs alot of work in
general.

You might be able fake it with a insert/update trigger in plpgsql
that makes sure that there are no matching rows.  It wouldn't exactly
be the same thing as a unique constraint, but it'd probably be close
enough for most use.

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Information regarding foriegn key constraint.
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: where clause bug