Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit033eb15

Browse files
committed
Fix LISTEN/NOTIFY race condition reported by Laurent Birtz, by postponing
pg_listener modifications commanded by LISTEN and UNLISTEN until the endof the current transaction. This allows us to hold the ExclusiveLock onpg_listener until after commit, with no greater risk of deadlock than therewas before. Aside from fixing the race condition, this gets rid of atruly ugly kludge that was there before, namely having to ignoreHeapTupleBeingUpdated failures during NOTIFY. There is a small potentialincompatibility, which is that if a transaction issues LISTEN or UNLISTENand then looks into pg_listener before committing, it won't see any resultingrow insertion or deletion, where before it would have. It seems unlikelythat anyone would be depending on that, though.This patch also disallows LISTEN and UNLISTEN inside a prepared transaction.That case had some pretty undesirable properties already, such as possiblyallowing pg_listener entries to be made for PIDs no longer present, sodisallowing it seems like a better idea than trying to maintain the behavior.
1 parent1c228fa commit033eb15

File tree

2 files changed

+344
-285
lines changed

2 files changed

+344
-285
lines changed

‎doc/src/sgml/ref/prepare_transaction.sgml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/prepare_transaction.sgml,v 1.6 2007/09/11 00:06:41 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/prepare_transaction.sgml,v 1.7 2008/03/12 20:11:45 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -88,8 +88,10 @@ PREPARE TRANSACTION <replaceable class="PARAMETER">transaction_id</replaceable>
8888

8989
<para>
9090
It is not currently allowed to <command>PREPARE</> a transaction that
91-
has executed any operations involving temporary tables or
92-
created any cursors <literal>WITH HOLD</>. Those features are too tightly
91+
has executed any operations involving temporary tables,
92+
created any cursors <literal>WITH HOLD</>, or executed
93+
<command>LISTEN</> or <command>UNLISTEN</>.
94+
Those features are too tightly
9395
tied to the current session to be useful in a transaction to be prepared.
9496
</para>
9597

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp