Re: Solution to UPDATE or INSERT Problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Solution to UPDATE or INSERT Problem
Дата
Msg-id 20924.1074490651@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Solution to UPDATE or INSERT Problem  (Curt Sampson <cjs@cynic.net>)
Список pgsql-general
Curt Sampson <cjs@cynic.net> writes:
> But why does session 2 hang
> in this instance?

Because the sub-SELECT sees a snapshot of transactions that were already
committed at the start of session 2's transaction.  If session 1 hasn't
committed yet, the EXISTS will return false.  The actual INSERT will
notice the inserted-but-not-yet-committed row, and will block waiting to
see whether it gets committed or not.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Solution to UPDATE or INSERT Problem
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Tool to ease development of plpgsql