Re: RE: [GENERAL] update inside transaction violates unique constraint?

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: "Mikheev, Vadim" <vmikheev(at)SECTORBASE(dot)COM>
Cc: "'Andrew Sullivan'" <sullivana(at)bpl(dot)on(dot)ca>, "'hackers(at)postgresql(dot)org'" <hackers(at)postgresql(dot)org>
Subject: Re: RE: [GENERAL] update inside transaction violates unique constraint?
Date: 2000-09-26 21:56:05
Message-ID: 39D11B75.F13ED881@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Mikheev, Vadim" wrote:
>
> > I get an error (which is good). But, if I do
> >
> > #BEGIN;
> > #SELECT * FROM name_and_ip WHERE name = 'foo' OR name = 'bar' FOR
> > UPDATE;
> > #UPDATE name_and_ip SET ip = '192.168.186.249' where name = 'foo';
> > UPDATE 1
> > #COMMIT;
> > COMMIT
>
> Btree doesn't take into account that tuple was just marked for update
> but still alive. Seems it was handled properly in 6.5.X ?

Nope. It has been broken a long time...

hannu=> select version();
version
-------------------------------------------------------------------
PostgreSQL 6.5.3 on i586-pc-linux-gnu, compiled by gcc egcs-2.91.66
(1 row)

hannu=> create table T(i int);
CREATE
hannu=> create unique index TUI on T(I);
CREATE
hannu=> insert into T values(1);
INSERT 109150 1
hannu=> insert into T values(2);
INSERT 109151 1
hannu=> begin;
BEGIN
hannu=> select * from T where I in (1,2)for update;
i
-
1
2
(2 rows)

hannu=> update T set I=1 where I=2;
UPDATE 1
hannu=> commit;
END
hannu=> select * from T;
i
-
1
1
(2 rows)

> I'll take a look...
>
> Vadim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2000-09-26 22:00:30 use of / in ~ vs. ~*
Previous Message Hannu Krosing 2000-09-26 21:52:24 Re: SV: Case sensitive field names