From: | "Sam Wong" <sam(at)hellosam(dot)net> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #4327: Primary key not refresh after cascaded deleted |
Date: | 2008-07-27 08:41:36 |
Message-ID: | 200807270841.m6R8fa6j043628@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 4327
Logged by: Sam Wong
Email address: sam(at)hellosam(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | andrew victoria | 2008-07-28 06:27:28 | BUG #4328: help in creating database encoded with LATIN1 |
Previous Message | Tom Lane | 2008-07-26 17:30:43 | Re: BUG #4324: Default value for a column is not returned in select when column has not been explicitly set |