Re: NOWAIT doesn't work

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: NOWAIT doesn't work
Дата
Msg-id 20121031140025.GB23139@alvh.no-ip.org
обсуждение исходный текст
Ответ на NOWAIT doesn't work  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: NOWAIT doesn't work
Re: NOWAIT doesn't work
Список pgsql-hackers
Pavel Stehule escribió:
> Hello
>
> it is expected behave?
>
> 1.session
>
> postgres=# begin;
> BEGIN
> postgres=# lock oo IN ACCESS EXCLUSIVE MODE;
> LOCK TABLE
>
> 2. session
>
> postgres=# select * from oo for update nowait;
>
> hangs forever ....

"select for update nowait" would raise an error if the tuple-level lock
is being held by some other process; but what's making it wait here is
the table-level lock.

Now, is this the right behavior?  I'm not sure.  But I know for certain
that making it behave as you expect is very tricky.  The table lock is
grabbed during parse analysis; we'd have to postpone grabbing the lock
until after we have had the chance to notice that there's a FOR UPDATE
clause for the table with a NOWAIT option attached.

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



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

Предыдущее
От: Christian Kruse
Дата:
Сообщение: Re: NOWAIT doesn't work
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: NOWAIT doesn't work