Обсуждение: Bug #508: update not atomic

Поиск
Список
Период
Сортировка

Bug #508: update not atomic

От
pgsql-bugs@postgresql.org
Дата:
John Havard (enigma@sevensages.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