Search Postgresql Archives

Re: LISTEN considered dangerous

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane <tgl@xxxxxxxxxxxxx> 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux