磨砺技术珠矶,践行数据之道,追求卓越价值 

回到上一级页面: PostgreSQL索引页

 

接上文:PostgreSQL的notify 与listen (一)

PostgreSQL的notify 与 listen, 有如下的描述信息:

http://www.postgresql.org/docs/9.0/static/sql-notify.html

......

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 非同步通知

回到上文:PostgreSQL的notify 与listen (一)

回到上一级页面: PostgreSQL索引页

磨砺技术珠矶,践行数据之道,追求卓越价值

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-27
  • 2021-06-23
  • 2021-10-01
  • 2021-06-15
  • 2022-02-08
  • 2022-01-29
  • 2022-12-23
相关资源
相似解决方案