lib/pq — pull request #156 by johto (2013-10-05 13:30:40+00:00)
Title: Add support for LISTEN/NOTIFY

This commit adds support for the PostgreSQL LISTEN/NOTIFY
mechanism by adding two new interfaces:

- ListenerConn is a low level interface which establishes
a connection to a PostgreSQL server and only knows how to
execute simple queries and wait for notifications. This
interface does not know how to reconnect, and does not
maintain a list of the channels it is listening on. This
interface is also undocumented, as its use is heavily
discouraged.
- Listener is the higher-level interface which uses
ListenerConn to provide a simpler to use interface,
supporting automatic reconnection. In order to do that,
also knows the list of channels it is already listening
on.

Significant contributions and ideas by Tommie Gannert. Ideas
and valuable feedback from Kamil Kisiel and Maciek Sakrejda.