Set transaction waiting mode and timeout

From: Durumdara <durumdara(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Set transaction waiting mode and timeout
Date: 2011-05-18 09:01:31
Message-ID: BANLkTindO7=6S81m=8kaYvgNtWT7kTHt0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

In Firebird the transaction can be parameterizable as:

SET TRANSACTION
...
[WAIT | NO WAIT]
[LOCK TIMEOUT seconds]

The "NO WAIT" is force transaction to return instantly with errormsg
when some deadlock situation happened, Timeout is define the seconds
for wait.
This can be set for each transaction I used.

I search for same option in pg if exists.
Because when I do this (theid field is primary key):

Con1.Begin
Con2.Begin
Con1.Exec(insert into x (theid, value) values (1, 'a'));
Con2.Exec(insert into x (theid, value) values (1, 'a'));
...
then Con2 is remaining in deadlock state (nothing happened, the code
is waiting for the transaction's end).

When Con1's transaction is end, Con2 is continue...

But users better like the ErrorMessage than incomprehensible "freezed screen".
And I also better like the controllable situation (I can re-try 3 times, etc.).

Thanks for your help:
dd

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-05-18 09:46:11 Re: re-install postgres/postGIS without Loosing data??
Previous Message G. P. 2011-05-18 08:06:08 Re: re-install postgres/postGIS without Loosing data??