title: Is it possible to automatically release a lock in PostgreSQL?
body: <p>I am testing the fault tolerance of an ActiveMQ system configured as JDBC Master/Slave. In this setup there is one postgres database and two brokers--one is the master broker, the other is a slave broker. The way this mechanism works is the master takes out an exclusive lock on a table in the db. The slave tries to do this also and waits until the lock becomes available. If the master dies, the lock should be released and the slave will take over. However, if the master loses network connectivity with the database, the lock is never released resulting in a deadlock scenario. What seems to be required here is a way to tell Postgres to automatically release the lock if not renewed within a specified period of time. The POSA 3 book of design patterns calls this the Leasing pattern. Is it possible to get Postgres to do this? If not, do other database vendors support it?</p>