Table locks
Posted in 1995
As read from the 4gl reference manual:
Lock Table
<Cut>
Notes:
1. Only one lock can apply to a table at any given time. That is, if a
user locks a table (in either SHARE or EXCLUSIVE mode), no other user can
lock that table in either mode until the first user unlocks it
From the Guide to SQL: Reference Manual
<Cut>
You can lock a table if you own the table or if you have select privilege
on the table or on a column in the table, either from a direct grant or
from a grant to public. The lock table fails if the table is already
locked by another process
<Cut>
SE The Informix-SE database engine does not permit more than one
user to lock a table in share mode
Ooops, this seems to imply that, contrary to what it was stated a couple
of lines earlier, the OnLine engine can put more than one share lock at
the same time on a table.
Given the different behaviour of the two engines, it seems to me that the
documentation should be more esplicit on the subject...
Now for a real bug:
On two different NCR towers, each equipped with online 4.10UC1, the
following 4gl code behaves strangely
lock table tbl in <whatever> mode
declare curs1 cursor for
select * from tbl #It's just an example, Mark!foreach curs1 into some_var
..
end foreach
..
..
..
unlock table tbl
Right after the foreach, the lock is gone (!!!): that is any process can
access the table. The funny thing is that the following unlock table does
not report a "Table not locked by current user" error.
Even stranger, if you try to run the previous code again within the same
session, everything works fine.
More generally, the lock is erroneously removed after the end foreach the
first time in a session each and any table is accessed with the previous
code.
On one of the two towers, We have installed V5.00 and the problem is
gone without even bothering to recompile th 4gl code.
Before you say, I know that 4.10 is no longer supported, but I never got
replied to this (and most of my other queryes) by the Italian Informix
distributor, and since I am in a bad mood today, I just feel like
reporting this bug.
Marco.