* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.145 2009/01/01 17:23:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.146 2009/02/13 17:12:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (Trace_notify)
elog(DEBUG1, "Async_Unlisten(%s,%d)", relname, MyProcPid);
+ /* If we couldn't possibly be listening, no need to queue anything */
+ if (pendingActions == NIL && !unlistenExitRegistered)
+ return;
+
queue_listen(LISTEN_UNLISTEN, relname);
}
if (Trace_notify)
elog(DEBUG1, "Async_UnlistenAll(%d)", MyProcPid);
+ /* If we couldn't possibly be listening, no need to queue anything */
+ if (pendingActions == NIL && !unlistenExitRegistered)
+ return;
+
queue_listen(LISTEN_UNLISTEN_ALL, "");
}