Re: LISTEN considered dangerous - Mailing list pgsql-general

From Greg Stark
Subject Re: LISTEN considered dangerous
Date
Msg-id 87lkq7w6t9.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: LISTEN considered dangerous  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.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

pgsql-general by date:

Previous
From: "Carlo Stonebanks"
Date:
Subject: Re: plTcl - how to create proc/function libraries
Next
From: Martijn van Oosterhout
Date:
Subject: Re: LISTEN considered dangerous