Re: data integrity - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: data integrity
Date
Msg-id Pine.LNX.4.33L2.0111061209170.10588-100000@aguila.protecne.cl
Whole thread Raw
In response to data integrity  (Jelle Ouwerkerk <jelle@openface.ca>)
List pgsql-general
On Mon, 5 Nov 2001, Jelle Ouwerkerk wrote:

> Problem: How are people dealing with data integrity issues such as stale
> data when writing web-based apps? For instance:
[...]

> In some scenarios, user B should be prevented from updating.

Maybe you can do something like this:

user A SELECTs the data, and the web app caches the fields.
user B does the same thing.
user B changes some fields and commits.
user A changes some fields and tries to commit. His webapp SELECTs the
data again and checks against its cache.
Since the data is different, the webapp presents him the three versions
and lets him choose.

The idea is to check every time you are going to commit the data to see
if it changed while you weren't looking. If it did, tell him so and let
him decide.

--
Alvaro Herrera (<alvherre[@]atentus.com>)
"Ni aun el genio muy grande llegaria muy lejos
si tuviera que sacarlo todo de su propio interior" (Goethe)


pgsql-general by date:

Previous
From: Dave Page
Date:
Subject: Re: [pgadmin-hackers] Use of Serial Datatype and Sequen
Next
From: Masaru Sugawara
Date:
Subject: Re: Probably simple answer