Fix UNLISTEN to fall out quickly if the current backend has never executed any LISTEN command.  This is more important than it used to be because DISCARD ALL invokes UNLISTEN.  Connection-pooled applications making heavy use of DISCARD ALL were seeing significant contention for pg_listener, as reported by Matteo Beccati.  It seems unlikely that clients using LISTEN would use pooled connections, so this simple tweak seems sufficient, especially since the pg_listener implementation is slated to go away soon anyway.
Fix UNLISTEN to fall out quickly if the current backend has never executed
any LISTEN command.  This is more important than it used to be because
DISCARD ALL invokes UNLISTEN.  Connection-pooled applications making heavy
use of DISCARD ALL were seeing significant contention for pg_listener,
as reported by Matteo Beccati.  It seems unlikely that clients using LISTEN
would use pooled connections, so this simple tweak seems sufficient,
especially since the pg_listener implementation is slated to go away soon
anyway.

Back-patch to 8.3, where DISCARD ALL was introduced.

Quikling/gpdb,ahachete/gpdb,ashwinstar/gpdb,cjcjameson/gpdb,royc1/gpdb,xuegang/gpdb,zaksoup/gpdb,zaksoup/gpdb,Chibin/gpdb,CraigHarris/gpdb,xinzweb/gpdb,chrishajas/gpdb,rvs/gpdb,janebeckman/gpdb,50wu/gpdb,chrishajas/gpdb,Quikling/gpdb,adam8157/gpdb,janebeckman/gpdb,xinzweb/gpdb,greenplum-db/gpdb,50wu/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,ahachete/gpdb,yuanzhao/gpdb,50wu/gpdb,zaksoup/gpdb,rvs/gpdb,50wu/gpdb,0x0FFF/gpdb,lisakowen/gpdb,zaksoup/gpdb,yuanzhao/gpdb,Quikling/gpdb,greenplum-db/gpdb,adam8157/gpdb,50wu/gpdb,chrishajas/gpdb,rvs/gpdb,rvs/gpdb,ahachete/gpdb,Chibin/gpdb,rvs/gpdb,edespino/gpdb,rvs/gpdb,lintzc/gpdb,Quikling/gpdb,lisakowen/gpdb,kaknikhil/gpdb,CraigHarris/gpdb,royc1/gpdb,Quikling/gpdb,greenplum-db/gpdb,xuegang/gpdb,jmcatamney/gpdb,Chibin/gpdb,ahachete/gpdb,lisakowen/gpdb,yuanzhao/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,janebeckman/gpdb,CraigHarris/gpdb,yuanzhao/gpdb,xuegang/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,0x0FFF/gpdb,ahachete/gpdb,50wu/gpdb,xinzweb/gpdb,zaksoup/gpdb,50wu/gpdb,royc1/gpdb,ashwinstar/gpdb,cjcjameson/gpdb,xinzweb/gpdb,0x0FFF/gpdb,greenplum-db/gpdb,xuegang/gpdb,royc1/gpdb,lintzc/gpdb,Chibin/gpdb,lisakowen/gpdb,lintzc/gpdb,royc1/gpdb,rvs/gpdb,ashwinstar/gpdb,lisakowen/gpdb,janebeckman/gpdb,royc1/gpdb,50wu/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,CraigHarris/gpdb,greenplum-db/gpdb,CraigHarris/gpdb,rvs/gpdb,ashwinstar/gpdb,chrishajas/gpdb,royc1/gpdb,ashwinstar/gpdb,xuegang/gpdb,janebeckman/gpdb,janebeckman/gpdb,cjcjameson/gpdb,lintzc/gpdb,zaksoup/gpdb,rvs/gpdb,janebeckman/gpdb,lisakowen/gpdb,Chibin/gpdb,Chibin/gpdb,lintzc/gpdb,kaknikhil/gpdb,adam8157/gpdb,edespino/gpdb,Quikling/gpdb,rvs/gpdb,xinzweb/gpdb,lisakowen/gpdb,zaksoup/gpdb,Quikling/gpdb,jmcatamney/gpdb,chrishajas/gpdb,ahachete/gpdb,zaksoup/gpdb,adam8157/gpdb,janebeckman/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,edespino/gpdb,adam8157/gpdb,edespino/gpdb,chrishajas/gpdb,cjcjameson/gpdb,yuanzhao/gpdb,Chibin/gpdb,cjcjameson/gpdb,lintzc/gpdb,kaknikhil/gpdb,chrishajas/gpdb,jmcatamney/gpdb,0x0FFF/gpdb,lintzc/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,0x0FFF/gpdb,edespino/gpdb,xinzweb/gpdb,greenplum-db/gpdb,CraigHarris/gpdb,adam8157/gpdb,cjcjameson/gpdb,kaknikhil/gpdb,edespino/gpdb,janebeckman/gpdb,Chibin/gpdb,xuegang/gpdb,CraigHarris/gpdb,ahachete/gpdb,CraigHarris/gpdb,adam8157/gpdb,cjcjameson/gpdb,Quikling/gpdb,lintzc/gpdb,jmcatamney/gpdb,xuegang/gpdb,Chibin/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,0x0FFF/gpdb,edespino/gpdb,janebeckman/gpdb,edespino/gpdb,0x0FFF/gpdb,Quikling/gpdb,edespino/gpdb,jmcatamney/gpdb,chrishajas/gpdb,Quikling/gpdb,xuegang/gpdb,xinzweb/gpdb,lisakowen/gpdb,greenplum-db/gpdb,adam8157/gpdb,0x0FFF/gpdb,xinzweb/gpdb,yuanzhao/gpdb,kaknikhil/gpdb,xuegang/gpdb,ashwinstar/gpdb,lintzc/gpdb,greenplum-db/gpdb,edespino/gpdb,ashwinstar/gpdb,royc1/gpdb,jmcatamney/gpdb,Chibin/gpdb,ahachete/gpdb,yuanzhao/gpdb