Re: Article on MySQL vs. Postgres

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Hannu Krosing <hannu@tm.ee>
Cc: Tim Perdue <tperdue@valinux.com>, The Hermit Hacker <scrappy@hub.org>, pgsql-hackers@hub.org
Date: 2000-07-05T16:16:30Z
Lists: pgsql-hackers
Hannu Krosing <hannu@tm.ee> writes:
> There a bug report that allowed tuplicate ids in an uniqe field when 
> SELECT FOR UPDATE was used. Could this be your case ?
> [snip]
> IIRC the fix was also provided, so it could be fixed in current CVS (the
> above is from 7.0.2, worked the same in 6.5.3)

It does seem to be fixed in current CVS:

regression=#  create table test(i int primary key);
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'test_pkey' for table 'test'
CREATE
regression=# insert into test values(1);
INSERT 145215 1
regression=# begin;
BEGIN
regression=# select * from test for update;
 i
---
 1
(1 row)

regression=# insert into test values(1);
ERROR:  Cannot insert a duplicate key into unique index test_pkey
regression=#


			regards, tom lane