Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> writes:
> Where do I release the lock ?
I'd say you shouldn't release it at all. Let it be held until end of
transaction.
rel = heap_open(relid, AccessExclusiveLock);
...
heap_close(rel, NoLock); /* close rel, keep lock till end of xact */
regards, tom lane