Search Postgresql Archives

Re: pg_try_advisory_lock is waiting?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mladen Gogala <gogala.mladen@xxxxxxxxx> writes:
> I tried the following:

> _*1st Session:*_

> mgogala=# begin transaction;
> BEGIN
> mgogala=*# update emp set sal=sal*1 where empno=7934;
> UPDATE 1
> mgogala=*#

> _*2nd Session:*_

> mgogala=# begin transaction;
> BEGIN
> mgogala=*# select pg_try_advisory_lock(0) from (select ename from emp 
> where empno=7934 for update) as tbl;

> To my infinite surprise, "pg_advisory_lock" is waiting.

I doubt it.  I think the FOR UPDATE in the sub-select is blocked
because the other session has an uncommitted update on the row
it wants to lock.  This command won't reach the pg_try_advisory_lock
call until that row lock comes free.

			regards, tom lane





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux