pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Jeffrey Pogodzinski <jrpogo@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: libpq program SELECT FOR UPDATE and TIMEOUT or CANCEL REQUEST
Date: Fri, 23 May 2003 10:08:16 -0500
Message-ID: <20030523150816.GA3935@wolff.to> (raw)
In-Reply-To: <11c19c42.0305190955.967d34@posting.google.com>
References: <11c19c42.0305190955.967d34@posting.google.com>

On Mon, May 19, 2003 at 10:55:23 -0700,
  Jeffrey Pogodzinski <jrpogo@yahoo.com> wrote:
> Hi,
> 
> I am programming using libpq under Linux.
> 
> When I do a "select ... for update" to lock a row, how 
> would I allow user to cancel or timeout when requesting the
> the same row from another program/transaction.

You can set statement_timeout.

> I do not want the user to have to wait for the update on the 
> other end. I would rather send the user an error message
> saying that the record is LOCKED -- try again later.

It is generally bad design to hold database locks while waiting for
user input. It is generally better to keep information about updates
in a table and have the applications use this information to advise
or prevent conncurrent updates to the same data by different people.



view thread (4+ messages)  latest in thread

Message-ID: <20030523150816.GA3935@wolff.to>
Permalink:  ../20030523150816.GA3935@wolff.to/
Also on:    postgresql.org/message-id/20030523150816.GA3935@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, jrpogo@yahoo.com
  Subject: Re: libpq program SELECT FOR UPDATE and TIMEOUT or CANCEL REQUEST
  In-Reply-To: <20030523150816.GA3935@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox