order of row processing affects updates

From: Paramveer(dot)Singh(at)trilogy(dot)com
To: "pgSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: order of row processing affects updates
Date: 2004-09-19 13:37:10
Message-ID: OF594A9028.8C47FF8A-ONE5256F14.0046B5E4@trilogy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all!
consider the following table

table a (id int primary key)
and a particular instance of it:
id
------------------------
5
6

now update a set id = id +1;
fails if the executor processes row with 5 first.
This means that the query will succeed sometimes and fail at other times
(when it processes 6 first).
Are there any workarounds to this?
Basically what we would like to do would be something like doing constraint
validations only at the end of execution of an update query, instead of
after every row update.

to see why sometimes this query might work, run the following commands:

create table a (id int primary key);
insert into a values (6);
insert into a values (5);
update a set id = id +1;

basically we would like to see uniformity in execution. Either the query
should always fail or always succeed.
Are there any standards on this?

any info will be helpful
paraM

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marius Andreiana 2004-09-19 14:11:18 Re: order of row processing affects updates
Previous Message Tim Penhey 2004-09-18 22:33:38 Re: pg_restore peculiarities