Re: race conditions in my sequences

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: race conditions in my sequences
Дата
Msg-id Pine.LNX.4.30.0108162137410.677-100000@peter.localdomain
обсуждение исходный текст
Ответ на race conditions in my sequences  (Jeremy Hansen <jeremy@xxedgexx.com>)
Список pgsql-general
Jeremy Hansen writes:

> I have three tables, primary key, bug_id.  Bug_id is a foreign key in the
> other two tables, with a cascade on update and delete.
>
> What I've done is created three sequences for each table for the bug_id.
> Sometimes the table with the primary key gets its sequence out of sync
> >from the other two tables and I start getting referential integrity
> violation problems and then all inserts  start getting dropped.

What you want is one sequence that generates the primary key, and the
foreign key columns you declare as integer and fill them in manually by
reading the generated primary key for the tuple you want to reference.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


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

Предыдущее
От: Tigran
Дата:
Сообщение: Win2K install
Следующее
От: Alexander Loginov
Дата:
Сообщение: Re[2]: Perfomance decreasing