Обсуждение:

Поиск
Список
Период
Сортировка

От
"Michael Vodep"
Дата:
Hi!
I have a table called "tbltest". There i want to avoid multiple updates at
the same time. so i tried to use the transaction method.
transaction 1                                              transaction 2
BEGIN;
SET TRANSACTION ISOLATION LEVEL
SERIALIZABLE;
SELECT * FROM tbltest WHERE id=0
FOR UPDATE;
                                                                 UPDATE
tbltest SET col1='test' WHERE id=0;

The update statement (transaction 2) waits, until i commited the transaction
1. How can i avoid this waiting? is it possible to get an error like "ERROR:
 id 0 is currently not available" - or somethink like this :-)

Thanks!!!
Michael

--
GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++