<neeraj(dot)punmiya(at)securetogether(dot)com> wrote:
> Create Table Test (x integer,y integer);
>
> Insert Into Test Values(1,100);
> Insert Into Test Values(2,200);
>
> First database session:
> ---------------------------
> start transaction;
> Lock table Test;
>
> Second database session
> -----------------------
> start transaction;
>
> Select y from Test where x=1 for update nowait;
>
> select query waits until first session releases table lock.
> Nowait does not have any effect in select statement.
That is all functioning as designed and documented. From the docs
at:
http://www.postgresql.org/docs/9.1/interactive/sql-select.html#SQL-FOR-UPDATE-SHARE
| Note that NOWAIT applies only to the row-level lock(s) * the
| required ROW SHARE table-level lock is still taken in the ordinary
| way (see Chapter 13). You can use LOCK with the NOWAIT option
| first, if you need to acquire the table-level lock without waiting.
This is not a bug.
-Kevin