Re: Unique Key Violation 7.0 vs. 6.5.3

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: bhirt(at)mobygames(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org, Brian Hirt <bhirt(at)loopy(dot)berkhirt(dot)com>
Subject: Re: Unique Key Violation 7.0 vs. 6.5.3
Date: 2000-04-07 00:58:04
Message-ID: 200004070058.UAA18917@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Hi,
>
> In doing some more 7.0 testing, I ran across a difference in functionality
> concerning unique indexes and errors that are reported when you try to
> violate the index. I'm not sure if this change is intentional, so I'm
> bringing it up here. In 6.5.3, if you try to update a row that violates
> a unique index, the query fails and said error is reported to the
> application. However, in 7.0 the query succeeds, but updates 0 rows. Hence,
> no errors are reported back to the application. This is not normally
> a problem because I typically check the constrait before updating.
>
>
> in 7.0/beta3
> basement=> update foobar set unique_colum = '2000-04-09' where foobar_id = 32;
> UPDATE 0
> basement=>
>
> in 6.5.3
> basement=> update foobar set unique_colum = '2000-04-09' where foobar_id = 32;
> ERROR: Cannot insert a duplicate key into a unique index
> basement=>

Works here:

test=> insert into kk values (1);
INSERT 18740 1
test=> insert into kk values (1);
ERROR: Cannot insert a duplicate key into unique index ii

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2000-04-07 01:00:17 RE: 7.0 like selectivity
Previous Message Don Baccus 2000-04-07 00:37:54 Re: Unique Key Violation 7.0 vs. 6.5.3