postgresql-simple- Mid-Level PostgreSQL client library

Safe HaskellNone



Support for receiving asynchronous notifications via PostgreSQL's Listen/Notify mechanism. See for more information.

Note that on Windows, getNotification currently uses a polling loop of 1 second to check for more notifications, due to some inadequacies in GHC's IO implementation and interface on that platform. See GHC issue #7353 for more information. While this workaround is less than ideal, notifications are still better than polling the database directly. Notifications do not create any extra work for the backend, and are likely cheaper on the client side as well.



getNotification :: Connection -> IO NotificationSource

Returns a single notification. If no notifications are available, getNotification blocks until one arrives.

getNotificationNonBlocking :: Connection -> IO (Maybe Notification)Source

Non-blocking variant of getNotification. Returns a single notification, if available. If no notifications are available, returns Nothing.