postgres-impl-listen-notify
Installation
SKILL.md
postgres-impl-listen-notify
Quick Reference :
LISTEN / NOTIFY is PostgreSQL's built-in publish-subscribe channel. A
session runs LISTEN channel to subscribe; any session runs NOTIFY channel, 'payload' (or pg_notify('channel', 'payload')) to broadcast. The
server delivers the payload asynchronously to every listening session.
It is a signalling mechanism, not a message queue. Three facts decide every design :
- Delivery is at COMMIT. A
NOTIFYinside a transaction is queued and sent only when that transaction commits; a rollback sends nothing. - There is no replay. A
LISTENis per-connection. A client that is not connected and listening at the moment of theNOTIFYmisses the event forever. Notifications are never stored or re-sent. - The payload is small. A payload must be a string literal under 8000 bytes. Send a row id, not the row.