aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/variable.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-03-08 10:27:03 -0500
committerRobert Haas <rhaas@postgresql.org>2016-03-08 10:27:03 -0500
commitdcfecaae9e35afe4fb11304267f547141842447d (patch)
tree56932fc011a835beaf6781c471a14e4323f93b72 /src/backend/commands/variable.c
parent070140ee48e8524493f882a278b5ced255b34b65 (diff)
downloadpostgresql-dcfecaae9e35afe4fb11304267f547141842447d.tar.gz
postgresql-dcfecaae9e35afe4fb11304267f547141842447d.zip
Fix parallel query on standby servers.
Without this fix, it inevitably bombs out with "ERROR: failed to initialize transaction_read_only to 0". Repair. Ashutosh Sharma; comments adjusted by me.
Diffstat (limited to 'src/backend/commands/variable.c')
-rw-r--r--src/backend/commands/variable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 903b3a63133..f801faacd29 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -482,11 +482,13 @@ show_log_timezone(void)
* nothing since XactReadOnly will be reset by the next StartTransaction().
* The IsTransactionState() test protects us against trying to check
* RecoveryInProgress() in contexts where shared memory is not accessible.
+ * (Similarly, if we're restoring state in a parallel worker, just allow
+ * the change.)
*/
bool
check_transaction_read_only(bool *newval, void **extra, GucSource source)
{
- if (*newval == false && XactReadOnly && IsTransactionState())
+ if (*newval == false && XactReadOnly && IsTransactionState() && !InitializingParallelWorker)
{
/* Can't go to r/w mode inside a r/o transaction */
if (IsSubTransaction())