磨砺技术珠矶,践行数据之道,追求卓越价值
回到上一级页面: 回到顶级页面:
接上文:
PostgreSQL的notify 与 listen, 有如下的描述信息:
......
Secondly, if a listening session receives a notification signal while it is within a transaction, the notification event will not be delivered to its connected client until just after the transaction is completed (either committed or aborted).
......
就是说,listen 动作接受信息只能在 事务 和 事务之间。
验证如下:
一 Session A
postgres#listen event01;postgres#begin;
postgres#select pg_sleep(100);postgres#二 Session B
postgres#notify event01;
三 然后回到 Session A
postgres#select pg_sleep(10);postgres#没有反应四 再执行:
postgres#commit;COMMIT收到 来自伺服器 "event01" 进程PID 5558 非同步通知
回到上文:
回到上一级页面: 回到顶级页面:
磨砺技术珠矶,践行数据之道,追求卓越价值