0002-allow-UNLISTEN-during-recovery.patch
text/x-patch
Filename: 0002-allow-UNLISTEN-during-recovery.patch
Type: text/x-patch
Part: 0
Patch
Format: format-patch
Series: patch 0002
Subject: Allow unlisten when in hot standby:wq
| File | + | − |
|---|---|---|
| doc/src/sgml/high-availability.sgml | 10 | 6 |
| src/backend/tcop/utility.c | 1 | 1 |
| src/test/regress/sql/hs_standby_allowed.sql | 4 | 0 |
| src/test/regress/sql/hs_standby_disallowed.sql | 0 | 2 |
From 8c816354e820bf3d0be69d55dbf0052b1d27feeb Mon Sep 17 00:00:00 2001
From: Shay Rojansky <roji@roji.org>
Date: Tue, 15 Jan 2019 18:49:40 +0100
Subject: [PATCH] Allow unlisten when in hot standby:wq
---
doc/src/sgml/high-availability.sgml | 16 ++++++++++------
src/backend/tcop/utility.c | 2 +-
src/test/regress/sql/hs_standby_allowed.sql | 4 ++++
src/test/regress/sql/hs_standby_disallowed.sql | 2 --
4 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml
index 4882b20828..bb1c86f73e 100644
--- a/doc/src/sgml/high-availability.sgml
+++ b/doc/src/sgml/high-availability.sgml
@@ -1767,6 +1767,11 @@ if (!triggered)
Plugins and extensions - <command>LOAD</command>
</para>
</listitem>
+ <listitem>
+ <para>
+ UNLISTEN
+ </para>
+ </listitem>
</itemizedlist>
</para>
@@ -1856,18 +1861,17 @@ if (!triggered)
</listitem>
<listitem>
<para>
- <command>LISTEN</command>, <command>UNLISTEN</command>, <command>NOTIFY</command>
+ <command>LISTEN</command>, <command>NOTIFY</command>
</para>
</listitem>
</itemizedlist>
</para>
<para>
- In normal operation, <quote>read-only</quote> transactions are allowed to
- use <command>LISTEN</command>, <command>UNLISTEN</command>, and
- <command>NOTIFY</command>, so Hot Standby sessions operate under slightly tighter
- restrictions than ordinary read-only sessions. It is possible that some
- of these restrictions might be loosened in a future release.
+ In normal operation, <quote>read-only</quote> transactions are allowed to use
+ <command>LISTEN</command>, and <command>NOTIFY</command>, so Hot Standby sessions
+ operate under slightly tighter restrictions than ordinary read-only sessions.
+ It is possible that some of these restrictions might be loosened in a future release.
</para>
<para>
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 27ae6be751..44136060d6 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -629,7 +629,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
{
UnlistenStmt *stmt = (UnlistenStmt *) parsetree;
- PreventCommandDuringRecovery("UNLISTEN");
+ /* allow UNLISTEN during recovery, which is a noop */
CheckRestrictedOperation("UNLISTEN");
if (stmt->conditionname)
Async_Unlisten(stmt->conditionname);
diff --git a/src/test/regress/sql/hs_standby_allowed.sql b/src/test/regress/sql/hs_standby_allowed.sql
index a33199dbbd..1f1cdf5a00 100644
--- a/src/test/regress/sql/hs_standby_allowed.sql
+++ b/src/test/regress/sql/hs_standby_allowed.sql
@@ -110,6 +110,10 @@ LOCK hs1 IN ROW SHARE MODE;
LOCK hs1 IN ROW EXCLUSIVE MODE;
COMMIT;
+-- UNLISTEN
+unlisten a;
+unlisten *;
+
-- LOAD
-- should work, easier if there is no test for that...
diff --git a/src/test/regress/sql/hs_standby_disallowed.sql b/src/test/regress/sql/hs_standby_disallowed.sql
index 21bbf526b7..a470600eec 100644
--- a/src/test/regress/sql/hs_standby_disallowed.sql
+++ b/src/test/regress/sql/hs_standby_disallowed.sql
@@ -88,8 +88,6 @@ COMMIT;
-- Listen
listen a;
notify a;
-unlisten a;
-unlisten *;
-- disallowed commands
--
2.19.1