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

BUG #3910: Incorrect behavior of UPDATE statement on tables with constraints UNIQUE/PRIMARY KEY

From: "Dmitry Afanasiev" <KOT(at)MATPOCKuH(dot)Ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3910: Incorrect behavior of UPDATE statement on tables with constraints UNIQUE/PRIMARY KEY
Date: 2008-01-29 09:45:28
Message-ID: 200801290945.m0T9jSv1085057@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3910
Logged by:          Dmitry Afanasiev
Email address:      KOT(at)MATPOCKuH(dot)Ru
PostgreSQL version: 7.4.19
Operating system:   FreeBSD 7.0 / 5.5
Description:        Incorrect behavior of UPDATE statement on tables with
constraints UNIQUE/PRIMARY KEY
Details: 

Constraints must be checked AFTER updating ALL of rows, but really after
every row.
For illustrate try this simple sql script:
CREATE TABLE n(n INTEGER PRIMARY KEY);
INSERT INTO n VALUES(1);
INSERT INTO n VALUES(2);
INSERT INTO n VALUES(3);
UPDATE n SET n = n + 1;
SELECT * FROM n;
DROP TABLE n;

On UPDATE psql says about violation UNIQUE constraint and does't update
anything.
For example, in Oracle all works propertly, and result of SELECT is:
SQL> select * from n;   

         N
----------
         2
         3
         4

Responses

pgsql-bugs by date

Next:From: Abhay KumarDate: 2008-01-29 10:08:58
Subject: Bugs
Previous:From: David E. WheelerDate: 2008-01-28 22:27:34
Subject: Re: BUG #3905: configure cannot find ossp UUID libs and/or includes

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