Bug #508: update not atomic

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #508: update not atomic
Date: 2001-11-04 03:57:17
Message-ID: 200111040357.fA43vHT16077@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

John Havard (enigma(at)sevensages(dot)org) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
update not atomic

Long Description
Version tested: 7.2b1, all 7.1

Update is not atomic. This really is not a problem, unless updating a field with a unique index.

Sample Code
jhavard=# CREATE TABLE blah (num int unique);
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'blah_num_key' for table 'blah'
CREATE
jhavard=# INSERT INTO blah VALUES (1);
INSERT 278477 1
jhavard=# INSERT INTO blah VALUES (2);
INSERT 278478 1
jhavard=# INSERT INTO blah VALUES (3);
INSERT 278479 1
jhavard=# INSERT INTO blah VALUES (4);
INSERT 278480 1
jhavard=# INSERT INTO blah VALUES (5);
INSERT 278481 1
jhavard=# UPDATE blah set num = num+2;
ERROR: Cannot insert a duplicate key into unique index blah_num_key

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message 畠中 晃弘 2001-11-05 11:38:00 JDBC driver bug?? (setBinaryStream)
Previous Message pgsql-bugs 2001-11-03 15:07:10 Bug #507: Granting insert on a table does not grant update to the ralated sequence