| From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
|---|---|
| To: | Jeffrey Pogodzinski <jrpogo(at)yahoo(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: libpq program SELECT FOR UPDATE and TIMEOUT or CANCEL REQUEST |
| Date: | 2003-05-23 15:08:16 |
| Message-ID: | 20030523150816.GA3935@wolff.to |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On Mon, May 19, 2003 at 10:55:23 -0700,
Jeffrey Pogodzinski <jrpogo(at)yahoo(dot)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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Johann Thoyer | 2003-05-23 15:12:21 | pg_connect |
| Previous Message | willy malth | 2003-05-23 14:33:45 | select lower('ÆØÅ ABC'); does not work as expected |