On Fri, Dec 20, 2024 at 2:42 PM Trey Boudreau <t...@treysoft.com> wrote:
> > > On Dec 20, 2024, at 2:58 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > > Seems reasonable in the abstract, and given the UNLISTEN * precedent > > it's hard to quibble with that syntax choice. I think what actually > > needs discussing are the semantics, specifically how this'd interact > > with other LISTEN/UNLISTEN actions. > > My first pass at the documentation looks like this: > > <para> > The special wildcard <literal>*</literal> cancels all listener > registrations for the current session and replaces them with a > virtual registration that matches all channels. Further > <command>LISTEN</command> and <command>UNLISTEN <replaceable > class="parameter">channel</replaceable></command> commands will > be ignored until the session sees the <command>UNLISTEN *</command> > command. > </para> > I just sent my thoughts here as well. The choice to "cancel all listener registrations" seems unintuitive and unnecessary - so long as we either document or handle deduplication internally. As I noted in my email, * is a permit-all policy in a "deny by default" system. Such a system is allowed to have other more targeted "allow" policies existing at the same time. If the permit-all policy gets removed then those individual allow policies immediately become useful again. If you want to remove those targeted allowed policies execute Unlisten * before executing Listen *. I dislike the non-symmetric meaning of * in the command sequence above but it likely is better than inventing a whole new syntax. David J.