diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index ef9f09a..5b90c06 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -126,6 +126,7 @@ #include "miscadmin.h" #include "storage/ipc.h" #include "storage/lmgr.h" +#include "storage/procarray.h" #include "storage/procsignal.h" #include "storage/sinval.h" #include "tcop/tcopprot.h" @@ -1978,7 +1979,13 @@ asyncQueueProcessPageEntries(QueuePosition *current, /* Ignore messages destined for other databases */ if (qe->dboid == MyDatabaseId) { - if (TransactionIdDidCommit(qe->xid)) + /* + * Similarly to the checks in tqual.c we must check if the + * transaction is still in progress, or we might send a + * notification emitted from a committed but not yet visible + * transaction. + */ + if (!TransactionIdIsInProgress(qe->xid) && TransactionIdDidCommit(qe->xid)) { /* qe->data is the null-terminated channel name */ char *channel = qe->data;