psql(1) does not output notifications asynchronously, as it does not check for them when idle. This makes it difficult to script handling of NOTIFYs. Attached is pqasyncnotifier.c, a simple command that allows one to handle NOTIFYs asynchronously.
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных