You cannot hold row locks after a transaction completes or rolls back.
This may be a reasonable precedent for advisory locks , although it is difficult to say with the limited information provided. Security locks can work at the session level, crossing transaction boundaries.
You cannot (ab) use a cursor WITH HOLD:
test=> DECLARE test_curs CURSOR WITH HOLD FOR SELECT * FROM dummy FOR UPDATE;
ERROR: DECLARE CURSOR WITH HOLD ... FOR UPDATE is not supported
DETAIL: Holdable cursors must be READ ONLY.
therefore, I think the advisory lock is pretty much your only option.
, , , . , , . - , , .
, concurrency , , - . , - , , , . , ORM, Hibernate, , Django concurrency, , , , .