Re: Unique Key Violation 7.0 vs. 6.5.3 - Mailing list pgsql-hackers

From Brian Hirt
Subject Re: Unique Key Violation 7.0 vs. 6.5.3
Date
Msg-id 20000406200935.C3604@loopy.berkhirt.com
Whole thread Raw
In response to Re: Unique Key Violation 7.0 vs. 6.5.3  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
It seems that I was a bit trigger happy with this one.  I should have
spent a bit more time researching this one.  I'm not quite sure how I
came to the conclusion I did.  I re-ran my tests and everything works
as it should.  Sorry.

--brian

On Thu, Apr 06, 2000 at 08:58:04PM -0400, Bruce Momjian wrote:
> > 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@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

-- 
The world's most ambitious and comprehensive PC game database project.
                     http://www.mobygames.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Closing down EvalPlanQual
Next
From: Tom Lane
Date:
Subject: Re: 7.0 like selectivity