Re: BUG #16454: Mixed isolation levels inside transactions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: lalbin(at)scharp(dot)org
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16454: Mixed isolation levels inside transactions
Date: 2020-05-21 02:14:02
Message-ID: 22443.1590027242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> I am seeing mixed/hybrid Isolation Levels when setting the isolation level
> to SERIALIZABLE READ ONLY DEFERRABLE, this also happens with REPEATABLE READ
> READ ONLY. The user tables sees only the data committed before the
> transaction begins but the system tables sees data committed by other
> transactions after the transaction begins. This means in my example the user
> tables are Serializable Isolation Level and the system tables are Read
> Committed Isolation Level.

As a general rule, all internal catalog accesses use latest-committed data
(so effectively Read Committed) regardless of what the user-level
visibility semantics are. This has to be so, because it just wouldn't do
to not be working with the latest data. As an example, you don't get to
ignore a CHECK constraint just because it got added after your transaction
started.

This does possibly result in some anomalies. We've judged that living
with that is better than the alternatives, which would involve imposing
far-more-draconian table locking and forced-transaction-rollback
requirements than exist now for serializable transactions. In the
example you give, the only practical alternative to the existing behavior
would be to fail the reader transaction as soon as it tries to access
the renamed schema.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Albin, Lloyd P 2020-05-21 02:51:34 RE: BUG #16454: Mixed isolation levels inside transactions
Previous Message Thomas Munro 2020-05-21 01:56:47 Re: BUG #16454: Mixed isolation levels inside transactions