Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-18 Thread desmodemone
> 2011/10/18 Robert Haas > >> On Mon, Oct 17, 2011 at 7:30 PM, desmodemone >> wrote: >> > Seems an Oracle bug not Postgresql one! >> >> I don't think it's a bug for it to work. It'd probably work in >> PostgreSQL too, if you inserted (2) first and then (1). It's just >> that, as Tom says, if yo

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-18 Thread desmodemone
Hi there, I could workaround the behavior with deferred constraint, and it's ok, but as I show, I have different behavior for constraint with the same definition in two rdbms and Postgresql depends on the physical order of row (with the same definition of constraint NOT DEFERRABLE INI

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread Peter Eisentraut
On tis, 2011-10-18 at 01:30 +0200, desmodemone wrote: > > alter table testup DROP CONSTRAINT testup_pkey ; > > alter table testup add primary key(a) DEFERRABLE INITIALLY > IMMEDIATE ; > > update testup set a=a+1 ; > UPDATE 2 > > commit; > > > Seems an Oracle bug not Postgresql one! Or

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread Tom Lane
Royce Ausburn writes: > On 18/10/2011, at 1:00 PM, Robert Haas wrote: >> I don't think it's a bug for it to work. It'd probably work in >> PostgreSQL too, if you inserted (2) first and then (1). It's just >> that, as Tom says, if you want it to be certain to work (rather than >> depending on the

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread Royce Ausburn
On 18/10/2011, at 1:00 PM, Robert Haas wrote: > On Mon, Oct 17, 2011 at 7:30 PM, desmodemone wrote: >> Seems an Oracle bug not Postgresql one! > > I don't think it's a bug for it to work. It'd probably work in > PostgreSQL too, if you inserted (2) first and then (1). It's just > that, as Tom

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread Robert Haas
On Mon, Oct 17, 2011 at 7:30 PM, desmodemone wrote: > Seems an Oracle bug not Postgresql one! I don't think it's a bug for it to work. It'd probably work in PostgreSQL too, if you inserted (2) first and then (1). It's just that, as Tom says, if you want it to be certain to work (rather than dep

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread desmodemone
Hello there Thanks Tom! By the way I find something very funny : Oracle 11gR2 : SQL> create table testup ( a number ) ; Tabella creata. SQL> alter table testup add primary key (a) NOT DEFERRABLE INITIALLY IMMEDIATE ; Tabella modificata. SQL> insert into testup values (1 ) ;

Re: [HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread Tom Lane
desmodemone writes: > create table testup ( a int ) ; > alter table testup add primary key (a ) ; > insert into testup values (1); > insert into testup values (2); > update testup set a=a+1 ; > ERROR: duplicate key value violates unique constraint "testup_pkey" > DETTAGLI: Key (a)=(2) alrea

[HACKERS] BUG or strange behaviour of update on primary key

2011-10-17 Thread desmodemone
Hello there, two guys of our developer team ( Lorenzo and Federico ) have seen a strange behaviour (in 8.4 and 9.1.1 ) on update, and I think is a bug or something really strange or I not understand correctly this behavior . I explain now ( begin transaction or auto commit is th