From: | JanWieck(at)t-online(dot)de (Jan Wieck) |
---|---|
To: | andrea(dot)aime(at)comune(dot)modena(dot)it |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Lock record |
Date: | 2000-06-14 22:45:52 |
Message-ID: | 200006142245.AAA08309@hot.jw.home |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Andrea Aime wrote:
> Hi people. I'm writing a client application in Visual Basic,
> and I need to lock certain records (a read lock) for
> a long period of time (well, from the start just to
> the stop of my application) so that no one can modify
> them. I've seen a lock command, but it seem only capable
> to lock an entire table. I'm using ADO, and it seem possible
> to lock a record by opening a recordset on it (with a
> proper query) and keeping that recordset open (I think
> that it's the cursor that keeps the lock on the db).
> Anyone knows a different/better method?
Skip and forget about anything below if your app isn't an
interactive one, waiting sometimes for user input.
Back in the late 80's, I remember that a customer payed
millions to Siemens just that they add a "hold DB lock over
interaction step" feature to their BS2000 UTM (system like
CICS on IBM). All that money was wasted because they never
really used that feature - after it was implemented they
discovered that all Siemens warnings about "that is extremely
dangerous" where true.
Believe it or not, but holding pure DB locks over
"interaction" in an interactive application isn't what you
really want! The user might go for coffee, and such long time
locks are not what the locking mechanism of databases is
intended for - so it's not optimized for this kind of abuse!
I've used a generic "lock-object" table in the past, and used
a LISTEN/NOTIFY mechanism along with lookup in pg_listener to
identify dead object locks with success. Need to dig out my
old 4.2 works - tell me if you need some details and I'll
strart to dig.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2000-06-14 22:53:37 | Re: large text fields? |
Previous Message | Steve Wolfe | 2000-06-14 21:48:16 | "Tuple is too big" |