Re: [INTERFACES] Transaction support in 6.5.3/JDBC

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [INTERFACES] Transaction support in 6.5.3/JDBC
Дата
Msg-id 29070.944701232@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [INTERFACES] Transaction support in 6.5.3/JDBC  (Assaf Arkin <arkin@exoffice.com>)
Список pgsql-interfaces
Assaf Arkin <arkin@exoffice.com> writes:
> I have a very simple test. I start two threads, both of them attempt to
> do an update on the exact same row in the table, both connections keep
> hanging.

Hmm.  The backend doesn't have any trouble detecting this; I checked
both current sources and 6.5.3:

play=> select * from z1;
f1
--12
(2 rows)

play=> begin;
BEGIN
play=> update z1 set f1 = 3 where f1 = 1;
UPDATE 1

<now in a second psql do>

play=> begin;
BEGIN
play=> update z1 set f1 = 4 where f1 = 2;
UPDATE 1
play=> update z1 set f1 = 3 where f1 = 1;

<second psql is now waiting for first one to commit or abort>

<back in first psql do>

play=> update z1 set f1 = 4 where f1 = 2;

After a second or so, one psql will say
NOTICE:  Deadlock detected -- See the lock(l) manual page for a possible cause.
ERROR:  WaitOnLock: error on wakeup - Aborting this transaction
and the other will say
UPDATE 1

If you're not getting this behavior, then either your test code is wrong
or there's something broken in the JDBC driver...
        regards, tom lane


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: "Christian Hang"
Дата:
Сообщение: Re: [INTERFACES] Re: ODBC and Large Objects, FAQ not working
Следующее
От: Peter Mount
Дата:
Сообщение: RE: [INTERFACES] Transaction support in 6.5.3/JDBC