Background​

The PGDBE automatically tracks record locks in ISAM-emulated tables, which are set by clients connected to the PostgreSQL server. This is done with the help of the __lock_owner field in the table's meta data. However, when a client dies unexpectantly, has it's network go down or does not properly disconnect for some other reason, record locks can be left "hanging". In this case, other clients are unable to manipulate/lock the record until these dead locks are removed.

Procedure​

In order to remove a dead record lock set by a client which is no longer connected, theoretically the record's __lock_owner could be cleared by the database administrator. However, while this procedure does make the record available for manipulation/locking again, the procedure does not correct the problem of dropped connections accumulating in the meta data of the database.

For this reason, it is recommended to clear the connection(s) in the alaska-software.system.connections table as well as resetting the __lock_owner field of the individual records. This step can either be performed manually by the database administrator, or it can be performed by an automated process, such as a script in PgAdmin.

The following SQL command clears all existing connections in the connection table:
SQL:
DELETE FROM "alaska-software.system.connections"

The following SQL command clears all dead locks:
SQL:
UPDATE <tablename> SET __lock_owner=0 WHERE __lock_owner<>0

Note: The _lock_owner field either is 0, or contains a value > 0 which is the connection id of the client owning the lock.