BUG #6748: sequence value may be conflict in some cases

From: meixiangming(at)huawei(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6748: sequence value may be conflict in some cases
Date: 2012-07-23 01:51:56
Message-ID: E1St7oS-0004Rg-Oc@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 6748
Logged by: Xiangming Mei
Email address: meixiangming(at)huawei(dot)com
PostgreSQL version: 9.1.4
Operating system: SUSE 11 X64
Description:

Reproduce steps:
1. create a table using serial such as:
CREATE TABLE tbl_aaa
(
sno serial NOT NULL, //自增序列,等同于sequence
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'.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Stehule 2012-07-23 06:33:18 Re: Duplicate rows primary key bug
Previous Message leo xu 2012-07-23 00:40:57 Duplicate rows primary key bug

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit kapila 2012-07-23 03:48:45 FW: Patch for option in pg_resetxlog for restore from WAL files
Previous Message Noah Misch 2012-07-22 23:50:03 Re: Restrict ALTER FUNCTION CALLED ON NULL INPUT (was Re: Not quite a security hole: CREATE LANGUAGE for non-superusers)