Re: LISTEN considered dangerous - Mailing list pgsql-general

From Tom Lane
Subject Re: LISTEN considered dangerous
Date
Msg-id 12140.1154498846@sss.pgh.pa.us
Whole thread Raw
In response to Re: LISTEN considered dangerous  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: LISTEN considered dangerous
Re: LISTEN considered dangerous
Re: LISTEN considered dangerous
List pgsql-general
Martijn van Oosterhout <kleptog@svana.org> writes:
> It's slightly surprising though. I havn't seen anyone else complain
> about this before though. The only way to fix this is to make the
> LISTEN completely atransactional, so NOTIFY can see uncomitted LISTENs
> also.

There isn't anything very desirable about the table-based approach to
NOTIFY :-(  I've previously proposed switching to an implementation
similar to sinval messaging, which would completely eliminate the need
for notifiers to be aware of who is listening.  However, I'm unconvinced
that the OP's complaint is valid.  I would still expect any
reimplementation of notify messaging to honor the principle that a
LISTEN doesn't take effect till you commit.  Otherwise, what of

    BEGIN;
    LISTEN foo;
    ROLLBACK;

?  If I get some events for foo after this I'd surely think it was
broken.

            regards, tom lane

pgsql-general by date:

Previous
From: Flemming Frandsen
Date:
Subject: Re: LISTEN considered dangerous
Next
From: Flemming Frandsen
Date:
Subject: Re: LISTEN considered dangerous