Re: Lock record - Mailing list pgsql-general

From JanWieck@t-online.de (Jan Wieck)
Subject Re: Lock record
Date
Msg-id 200006142245.AAA08309@hot.jw.home
Whole thread Raw
In response to Lock record  ("Andrea Aime" <aaime@comune.modena.it>)
Responses Re: Lock record  (Andrew Sullivan <sullivana@bpl.on.ca>)
List 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@Yahoo.com #



pgsql-general by date:

Previous
From: JanWieck@t-online.de (Jan Wieck)
Date:
Subject: Re: large text fields?
Next
From: Mark Stier
Date:
Subject: optimization by removing the file system layer?