BUG #6748: sequence value may be conflict in some cases - Mailing list pgsql-bugs

From meixiangming@huawei.com
Subject BUG #6748: sequence value may be conflict in some cases
Date
Msg-id E1St7oS-0004Rg-Oc@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #6748: sequence value may be conflict in some cases  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6748
Logged by:          Xiangming Mei
Email address:      meixiangming@huawei.com
PostgreSQL version: 9.1.4
Operating system:   SUSE 11 X64
Description:=20=20=20=20=20=20=20=20

Reproduce steps:
1. create a table using serial such as:
CREATE TABLE tbl_aaa
(
  sno serial NOT NULL,      //=E8=87=AA=E5=A2=9E=E5=BA=8F=E5=88=97=EF=BC=8C=
=E7=AD=89=E5=90=8C=E4=BA=8Esequence
  userid int NOT NULL,
  CONSTRAINT tbl_aaa_pkey PRIMARY KEY (sno)
);
2. insert a tuple:
INSERT INTO tbl_aaa values (DEFAULT, 1);
3. postgersql instance crashed, may be power lost or killed by someone:
4. restart the instance then insert another tuple into tbl_aaa, you will get
a error message:
INSERT INTO tbl_aaa values (DEFAULT, 2);
ERROR: SQLSTATE 23505: duplicate key value violates unique constraint
"tbl_aaa_pkey"
LOCATION: _bt_check_unique, nbtinsert.c:300

I think this is because there is no logit when 'is_called' become from 'f'
to 't'.

pgsql-bugs by date:

Previous
From: leo xu
Date:
Subject: primary and hot standby database don' work now
Next
From: leo xu
Date:
Subject: Duplicate rows primary key bug