diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 4cd4bcba80..b6d9773573 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -3667,6 +3667,15 @@ CALL transaction_test1();
CHAIN accomplish this.
+
+
+ If you have a client application waiting for a NOTIFY
+ event coming from this transaction, be aware that the notification will
+ only be sent after a COMMIT or a ROLLBACK
+ without AND CHAIN happens.
+
+
+
Transaction control is only possible in CALL or
DO invocations from the top level or nested
diff --git a/doc/src/sgml/ref/commit.sgml b/doc/src/sgml/ref/commit.sgml
index 5f244cdd3c..ebf4741b37 100644
--- a/doc/src/sgml/ref/commit.sgml
+++ b/doc/src/sgml/ref/commit.sgml
@@ -62,7 +62,15 @@ COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
linkend="sql-set-transaction"/>) as the just finished one. Otherwise,
no new transaction is started.
-
+
+
+ If you have a client application waiting for a NOTIFY
+ event coming from this transaction, be aware that the notification will
+ only be sent when a COMMIT or a ROLLBACK
+ without AND CHAIN will be issued.
+
+
+
diff --git a/doc/src/sgml/ref/end.sgml b/doc/src/sgml/ref/end.sgml
index 498652919a..8a05c05d14 100644
--- a/doc/src/sgml/ref/end.sgml
+++ b/doc/src/sgml/ref/end.sgml
@@ -60,6 +60,14 @@ END [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
linkend="sql-set-transaction"/>) as the just finished one. Otherwise,
no new transaction is started.
+
+
+ If you have a client application waiting for a NOTIFY
+ event coming from this transaction, be aware that the notification will
+ only be sent after a COMMIT or a ROLLBACK
+ without AND CHAIN happens.
+
+
diff --git a/doc/src/sgml/ref/notify.sgml b/doc/src/sgml/ref/notify.sgml
index d7dcbea02d..020ff3d569 100644
--- a/doc/src/sgml/ref/notify.sgml
+++ b/doc/src/sgml/ref/notify.sgml
@@ -121,6 +121,14 @@ NOTIFY channel [ ,
+
+
+ If you have a client application waiting for a NOTIFY
+ event coming from this transaction, be aware that the notification will
+ only be sent after a COMMIT or a ROLLBACK
+ without AND CHAIN happens.
+
+
diff --git a/doc/src/sgml/ref/rollback.sgml b/doc/src/sgml/ref/rollback.sgml
index 142f71e774..9bb57369ff 100644
--- a/doc/src/sgml/ref/rollback.sgml
+++ b/doc/src/sgml/ref/rollback.sgml
@@ -61,6 +61,14 @@ ROLLBACK [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
linkend="sql-set-transaction"/>) as the just finished one. Otherwise,
no new transaction is started.
+
+
+ If you have a client application waiting for a NOTIFY
+ event coming from this transaction, be aware that the notification will
+ only be sent when a COMMIT or a ROLLBACK
+ without AND CHAIN will be issued.
+
+
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 6597ec45a9..84e6a4225e 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -3006,6 +3006,12 @@ CommitTransactionCommand(void)
s->blockState = TBLOCK_DEFAULT;
if (s->chain)
{
+ /*
+ * Before starting the new transaction, we'll update the
+ * statistics so that autovacuum can be triggered without
+ * waiting for a `commit` or `rollback` without `and chain`.
+ */
+ pgstat_report_stat(false);
StartTransaction();
s->blockState = TBLOCK_INPROGRESS;
s->chain = false;
@@ -3032,6 +3038,12 @@ CommitTransactionCommand(void)
s->blockState = TBLOCK_DEFAULT;
if (s->chain)
{
+ /*
+ * Before starting the new transaction, we'll update the
+ * statistics so that autovacuum can be triggered without
+ * waiting for a `commit` or `rollback` without `and chain`.
+ */
+ pgstat_report_stat(false);
StartTransaction();
s->blockState = TBLOCK_INPROGRESS;
s->chain = false;
@@ -3050,6 +3062,12 @@ CommitTransactionCommand(void)
s->blockState = TBLOCK_DEFAULT;
if (s->chain)
{
+ /*
+ * Before starting the new transaction, we'll update the
+ * statistics so that autovacuum can be triggered without
+ * waiting for a `commit` or `rollback` without `and chain`.
+ */
+ pgstat_report_stat(false);
StartTransaction();
s->blockState = TBLOCK_INPROGRESS;
s->chain = false;
@@ -3117,6 +3135,12 @@ CommitTransactionCommand(void)
s->blockState = TBLOCK_DEFAULT;
if (s->chain)
{
+ /*
+ * Before starting the new transaction, we'll update the
+ * statistics so that autovacuum can be triggered without
+ * waiting for a `commit` or `rollback` without `and chain`.
+ */
+ pgstat_report_stat(false);
StartTransaction();
s->blockState = TBLOCK_INPROGRESS;
s->chain = false;