Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbaiq-0004hw-4G for pgsql-bugs@arkaria.postgresql.org; Thu, 21 May 2020 02:14:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbaio-0000Ws-MD for pgsql-bugs@arkaria.postgresql.org; Thu, 21 May 2020 02:14:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbaio-0000Wk-Fk for pgsql-bugs@lists.postgresql.org; Thu, 21 May 2020 02:14:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbaih-0001sT-EL for pgsql-bugs@lists.postgresql.org; Thu, 21 May 2020 02:14:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 04L2E22W022445; Wed, 20 May 2020 22:14:02 -0400 From: Tom Lane To: lalbin@scharp.org cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16454: Mixed isolation levels inside transactions In-reply-to: <16454-9408996bb1750faf@postgresql.org> References: <16454-9408996bb1750faf@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 21 May 2020 00:52:29 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22442.1590027242.1@sss.pgh.pa.us> Date: Wed, 20 May 2020 22:14:02 -0400 Message-ID: <22443.1590027242@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form 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