BUG #4327: Primary key not refresh after cascaded deleted

Поиск
Список
Период
Сортировка
От Sam Wong
Тема BUG #4327: Primary key not refresh after cascaded deleted
Дата
Msg-id 200807270841.m6R8fa6j043628@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #4327: Primary key not refresh after cascaded deleted
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      4327
Logged by:          Sam Wong
Email address:      sam@hellosam.net
PostgreSQL version: 8.3.1
Operating system:   Linux Debian
Description:        Primary key not refresh after cascaded deleted
Details:

Say, I have two table A and B.

That A has one column:
A_primary_col
...and keys:
PRIMARY KEY (A_primary_col)

That B has two columns:
B_primary_col, A_reference
...and keys:
PRIMARY KEY (b_primary_col)
FOREIGN KEY (A_reference) REFERENCES A(A_primary_col) ON DELETE CASCADE

Now I inserted the following records into
into A:
1
2
3

into B:
A,1
B,2
C,3

Now I delete all records from A:
DELETE FROM A;
so that both table is empty now.

Now when I try to insert the following:
into A:
4

Then when I try to insert the following into B:
A,4

Expected Behavior:
it will insert with no problem

Actual Behavior:
it will say
duplicate key value violates unique constraint "B_primary_column_pkey".

Workaround:
Analyze the table B.

I believe that's a bug that the primary key index is not updated
accordingly? Thanks.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4324: Default value for a column is not returned in select when column has not been explicitly set
Следующее
От: "andrew victoria"
Дата:
Сообщение: BUG #4328: help in creating database encoded with LATIN1