Skip to content

Commit dcfecaa

Browse files
committed
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.
1 parent 070140e commit dcfecaa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/commands/variable.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,13 @@ show_log_timezone(void)
482482
* nothing since XactReadOnly will be reset by the next StartTransaction().
483483
* The IsTransactionState() test protects us against trying to check
484484
* RecoveryInProgress() in contexts where shared memory is not accessible.
485+
* (Similarly, if we're restoring state in a parallel worker, just allow
486+
* the change.)
485487
*/
486488
bool
487489
check_transaction_read_only(bool *newval, void **extra, GucSource source)
488490
{
489-
if (*newval == false && XactReadOnly && IsTransactionState())
491+
if (*newval == false && XactReadOnly && IsTransactionState() && !InitializingParallelWorker)
490492
{
491493
/* Can't go to r/w mode inside a r/o transaction */
492494
if (IsSubTransaction())

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy