From: | Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> |
---|---|
To: | bhirt(at)mobygames(dot)com |
Cc: | pgsql-hackers(at)postgresql(dot)org, bhirt(at)loopy(dot)berkhirt(dot)com |
Subject: | Re: Unique Key Violation 7.0 vs. 6.5.3 |
Date: | 2000-04-07 01:23:43 |
Message-ID: | 20000407102343X.t-ishii@sra.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 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=>
I'm not sure how your table looks like, but seems following test with
current (not b3) works here:
test=# create table foobar (unique_column date unique, foobar_id int primary key);
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'foobar_unique_column_key' for table 'foobar'
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'foobar_pkey' for table 'foobar'
CREATE
test=# insert into foobar values('2000-4-8', 32);
INSERT 2231126 1
test=# insert into foobar values('2000-4-9', 33);
INSERT 2231127 1
test=# update foobar set unique_column = '2000-04-09' where foobar_id = 32;
ERROR: Cannot insert a duplicate key into unique index foobar_unique_column_key
--
Tatsuo Ishii
From pgsql-hackers-owner(at)hub(dot)org Thu Apr 6 21:26:03 2000
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-04-08 03:48:30 | Re: [HACKERS] Doc updates |
Previous Message | Tom Lane | 2000-04-07 01:12:09 | Re: 7.0 like selectivity |