Skip site navigation (1) Skip section navigation (2)

Re: Unique Key Violation 7.0 vs. 6.5.3

From: Brian Hirt <bhirt(at)mobygames(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: bhirt(at)mobygames(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unique Key Violation 7.0 vs. 6.5.3
Date: 2000-04-07 01:09:35
Message-ID: 20000406200935.C3604@loopy.berkhirt.com (view raw or flat)
Thread:
Lists: 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(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

-- 
The world's most ambitious and comprehensive PC game database project.

                      http://www.mobygames.com

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2000-04-07 01:12:09
Subject: Re: 7.0 like selectivity
Previous:From: Tom LaneDate: 2000-04-07 01:07:26
Subject: Closing down EvalPlanQual

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group