pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Koval <d.koval@postgrespro.ru>
To: andrewbille@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end
Date: Fri, 28 Jan 2022 18:26:08 +0300
Message-ID: <b22395d2-d432-f211-0bed-1f466df75152@postgrespro.ru> (raw)
In-Reply-To: <17385-9ee529fb091f0ce5@postgresql.org>
References: <17385-9ee529fb091f0ce5@postgresql.org>

Hi,

Additional information. Query
"RESET transaction_isolation;"
in previous message can be replaced to synonym
"SET transaction_isolation=DEFAULT;"
(error will be the same).

I attached file with simple fix for branch "master".

I not sure that need to use a separate block of code for the
"transaction_isolation" GUC-variable. But this is a special variable
and there are several places in the code with handling of this variable.

With best regards,
Dmitry Koval.

Attachments:

v1-0001-Fixed-reset-transaction_isolation.patch (text/plain, 1.8K) download diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index e5ddcda0b4..038da968b6 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -531,14 +531,16 @@ check_XactIsoLevel(int *newval, void **extra, GucSource source) if (FirstSnapshotSet) { GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION); - GUC_check_errmsg("SET TRANSACTION ISOLATION LEVEL must be called before any query"); + GUC_check_errmsg("%s TRANSACTION ISOLATION LEVEL must be called before any query", + (source == PGC_S_OVERRIDE) ? "RESET" : "SET"); return false; } /* We ignore a subtransaction setting it to the existing value. */ if (IsSubTransaction()) { GUC_check_errcode(ERRCODE_ACTIVE_SQL_TRANSACTION); - GUC_check_errmsg("SET TRANSACTION ISOLATION LEVEL must not be called in a subtransaction"); + GUC_check_errmsg("%s TRANSACTION ISOLATION LEVEL must not be called in a subtransaction", + (source == PGC_S_OVERRIDE) ? "RESET" : "SET"); return false; } /* Can't go to serializable mode while recovery is still active */ diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 4c94f09c64..2ffd6fb844 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -8021,6 +8021,17 @@ set_config_option(const char *name, const char *value, newextra = conf->reset_extra; source = conf->gen.reset_source; context = conf->gen.reset_scontext; + + /* + * Reseted transaction_isolation value can be not + * applicable to current transaction + */ + if (strcmp(name, "transaction_isolation") == 0) + { + if (!call_enum_check_hook(conf, &newval, &newextra, + source, elevel)) + return 0; + } } if (prohibitValueChange)

view thread (44+ messages)  latest in thread

Message-ID: <b22395d2-d432-f211-0bed-1f466df75152@postgrespro.ru>
Permalink:  ../b22395d2-d432-f211-0bed-1f466df75152@postgrespro.ru/
Also on:    postgresql.org/message-id/b22395d2-d432-f211-0bed-1f466df75152@postgrespro.ru

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: d.koval@postgrespro.ru, andrewbille@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end
  In-Reply-To: <b22395d2-d432-f211-0bed-1f466df75152@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox