Re: LISTEN considered dangerous

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Gregory Stark <gsstark(at)mit(dot)edu>, harding(dot)ian(at)gmail(dot)com, Flemming Frandsen <ff(at)partyticket(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: LISTEN considered dangerous
Date: 2006-08-02 06:07:26
Message-ID: 12140.1154498846@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Flemming Frandsen 2006-08-02 06:25:45 Re: LISTEN considered dangerous
Previous Message Flemming Frandsen 2006-08-02 05:57:55 Re: LISTEN considered dangerous