Another unexpected behaviour

From: Shianmiin <Shianmiin(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Another unexpected behaviour
Date: 2011-07-18 22:18:43
Message-ID: 1311027523640-4610242.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

setup:
====
drop table if exists t1;
create table t1 (f1 int);
create unique index uix_t1 on t1(f1) ;
insert into t1(f1) values (1), (2), (3);
select * from t1;

f1
---
1
2
3

test statement:
============
update t1 set f1 = f1 + 1;

In PostgreSQL I got,
ERROR: duplicate key value violates unique constraint "uix_t1"
DETAIL: Key (f1)=(2) already exists.

I tried the same test statement in both SQL Server and Oracle
I got correct/expected results as below:

select * from t1;

f1
---
2
3
4

I thought the Atomic should be at statement level, could anyone tell me why
PostgreSQL behaves differently?

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Another-unexpected-behaviour-tp4610242p4610242.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jon Smark 2011-07-18 22:35:39 Re: Alarm function in PL/pgSQL
Previous Message Hans C. Poo 2011-07-18 22:12:21 Database level read only user