diff options
author | Robert Haas <rhaas@postgresql.org> | 2011-01-22 20:51:32 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2011-01-22 20:55:50 -0500 |
commit | 6f59777c65d557485e933a383ebc4c3fdfc1a2b7 (patch) | |
tree | b5ce0b0f7d50c18b09e38b75b2a43082bf4deac3 /src/backend/utils/misc/guc.c | |
parent | cc73c160507588bdc5822d7f2bb79d6b3a386761 (diff) | |
download | postgresql-6f59777c65d557485e933a383ebc4c3fdfc1a2b7.tar.gz postgresql-6f59777c65d557485e933a383ebc4c3fdfc1a2b7.zip |
Code cleanup for assign_transaction_read_only.
As in commit fb4c5d2798730f60b102d775f22fb53c26a6445d on 2011-01-21,
this avoids spurious debug messages and allows idempotent changes at
any time. Along the way, make assign_XactIsoLevel allow idempotent
changes even when not within a subtransaction, to be consistent with
the new coding of assign_transaction_read_only and because there's
no compelling reason to do otherwise.
Kevin Grittner, with some adjustments.
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 73b9f1b01ca..2c95ef80c45 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -168,7 +168,6 @@ static bool assign_bonjour(bool newval, bool doit, GucSource source); static bool assign_ssl(bool newval, bool doit, GucSource source); static bool assign_stage_log_stats(bool newval, bool doit, GucSource source); static bool assign_log_stats(bool newval, bool doit, GucSource source); -static bool assign_transaction_read_only(bool newval, bool doit, GucSource source); static const char *assign_canonical_path(const char *newval, bool doit, GucSource source); static const char *assign_timezone_abbreviations(const char *newval, bool doit, GucSource source); static const char *show_archive_command(void); @@ -7843,34 +7842,6 @@ assign_log_stats(bool newval, bool doit, GucSource source) return true; } -static bool -assign_transaction_read_only(bool newval, bool doit, GucSource source) -{ - /* Can't go to r/w mode inside a r/o transaction */ - if (newval == false && XactReadOnly && IsSubTransaction()) - { - ereport(GUC_complaint_elevel(source), - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot set transaction read-write mode inside a read-only transaction"))); - /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */ - if (source != PGC_S_OVERRIDE) - return false; - } - - /* Can't go to r/w mode while recovery is still active */ - if (newval == false && XactReadOnly && RecoveryInProgress()) - { - ereport(GUC_complaint_elevel(source), - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot set transaction read-write mode during recovery"))); - /* source == PGC_S_OVERRIDE means do it anyway, eg at xact abort */ - if (source != PGC_S_OVERRIDE) - return false; - } - - return true; -} - static const char * assign_canonical_path(const char *newval, bool doit, GucSource source) { |