Re: LISTEN considered dangerous

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, 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 14:28:18
Message-ID: 87lkq7w6t9.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> 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.

Well the rollback would roll back any consequences of the notify handler
firing too. So the transactional nature would still be maintained.

I'm not sure why you're imagining that the listen would still be in effect
after the rollback. rollback would return the connection state to the same
state it was in before the transaction.

I Think of GUC variables like enable_* as a good analogy. If you fiddle with
them their effects are felt immediately by your transaction. You don't have to
commit to make those changes take effect. If you roll back your changes their
original state is restored.

--
greg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-08-02 14:29:35 Re: LISTEN considered dangerous
Previous Message Carlo Stonebanks 2006-08-02 14:24:53 Re: plTcl - how to create proc/function libraries