Re: Discussion on a LISTEN-ALL syntax

2024-12-22 Thread Trey Boudreau
> On Dec 20, 2024, at 4:07 PM, Tom Lane wrote: > > Hmph. After thinking about it a bit I have a different idea > (and I see David has yet a third one). So maybe this is more > contentious than it seems. But at any rate, I have two > fundamental thoughts: > > * "Listen to all but X" seems lik

Re: Discussion on a LISTEN-ALL syntax

2024-12-21 Thread Trey Boudreau
> On Dec 20, 2024, at 4:45 PM, Tom Lane wrote: > > "David G. Johnston" writes: >> On Friday, December 20, 2024, Tom Lane wrote: >>> * "Listen to all but X" seems like a reasonable desire. > >> This I concur with, and would add: let me name my channels >> accounting.payables, accounting.recei

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Vik Fearing
On 21/12/2024 05:23, Tom Lane wrote: Vik Fearing writes: Could I perhaps propose a sort of wildmat[1] syntax? The above sequence could be expressed simply as:     LISTEN *,!foo.*,foo.bar.* That doesn't absolve you from having to say what happens if the user then issues another "LISTEN zed"

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Tom Lane
Vik Fearing writes: > Could I perhaps propose a sort of wildmat[1] syntax? > The above sequence could be expressed simply as: >     LISTEN *,!foo.*,foo.bar.* That doesn't absolve you from having to say what happens if the user then issues another "LISTEN zed" or "UNLISTEN foo.bar.baz" command.

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Vik Fearing
On 20/12/2024 23:45, Tom Lane wrote: Don't think that quite flies. We might have to regurgitate the state explicitly: LISTEN * UNLISTEN foo.* LISTEN foo.bar.* showing that we're listening to channels foo.bar.*, but not other channels beginning "foo", and also to all c

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Daniel Gustafsson
> On 20 Dec 2024, at 23:07, Tom Lane wrote: > ..it makes "LISTEN *" act the same as though you had somehow explicitly listed > every possible channel. When thinking about it while reading this thread, this is what I came up with as well. Since the current workings of LISTEN is so well establish

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Tom Lane
"David G. Johnston" writes: > On Friday, December 20, 2024, Tom Lane wrote: >> * "Listen to all but X" seems like a reasonable desire. > This I concur with, and would add: let me name my channels > accounting.payables, accounting.receivables, sales.leads; and let me listen > or ignore all accoun

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread David G. Johnston
On Friday, December 20, 2024, Tom Lane wrote: > Trey Boudreau writes: > > * "Listen to all but X" seems like a reasonable desire. > This I concur with, and would add: let me name my channels accounting.payables, accounting.receivables, sales.leads; and let me listen or ignore all accounting/sal

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Tom Lane
Trey Boudreau writes: > My first pass at the documentation looks like this: > > The special wildcard * cancels all listener > registrations for the current session and replaces them with a > virtual registration that matches all channels. Further > LISTEN and UNLISTEN class="parameter">cha

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread David G. Johnston
On Fri, Dec 20, 2024 at 2:42 PM Trey Boudreau wrote: > We could have a different set of keywords, like LISTEN_ALL/UNLISTEN_ALL > that doesn’t interfere with the existing behavior. > > I think we will need something along these lines. We've given * a meaning in UNLISTEN * that doesn't match what

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread David G. Johnston
On Fri, Dec 20, 2024 at 2:42 PM Trey Boudreau wrote: > > > On Dec 20, 2024, at 2:58 PM, Tom Lane 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, specif

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread David G. Johnston
On Fri, Dec 20, 2024 at 1:58 PM Tom Lane wrote: > Trey Boudreau writes: > > so I'd like to propose a 'LISTEN *' equivalent to 'UNLISTEN *'. > > Seems reasonable in the abstract, and given the UNLISTEN * precedent > it's hard to quibble with that syntax choice. I think what actually > needs disc

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Trey Boudreau
> On Dec 20, 2024, at 2:58 PM, Tom Lane 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

Re: Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Tom Lane
Trey Boudreau writes: > so I'd like to propose a 'LISTEN *' equivalent to 'UNLISTEN *'. 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 wi

Discussion on a LISTEN-ALL syntax

2024-12-20 Thread Trey Boudreau
Howdy all, NOTE: Grey-beard coder, pgsql newbie. All info/tips/suggestions welcome! I have a use-case where I’d like to LISTEN for all NOTIFY channels. Right now I simply issue a LISTEN for every channel name of interest, but in production the channels will number in the low thousands. The cur