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 1pXGLE-0005w3-I2 for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Mar 2023 06:53:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXGLD-0001r6-7f for pgsql-bugs@arkaria.postgresql.org; Wed, 01 Mar 2023 06:53:31 +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 1pXGLC-0001qx-Vm for pgsql-bugs@lists.postgresql.org; Wed, 01 Mar 2023 06:53:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXGL6-0001fy-NO for pgsql-bugs@lists.postgresql.org; Wed, 01 Mar 2023 06:53:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3216rMFJ1328698; Wed, 1 Mar 2023 01:53:23 -0500 From: Tom Lane To: "David G. Johnston" cc: Keyerror Smart , Julien Rouhaud , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17812: LOCK TABLE IN ACCESS EXCLUSIVE MODE with a view returns an empty tuple set In-reply-to: References: <17812-206eaec1d133a94a@postgresql.org> <20230228135252.agaj42dik5qfjjxi@jrouhaud> <20230301025229.rxmmjxfvg45w2cj4@jrouhaud> <1311639.1677643997@sss.pgh.pa.us> Comments: In-reply-to "David G. Johnston" message dated "Tue, 28 Feb 2023 21:55:40 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1328696.1677653602.1@sss.pgh.pa.us> Date: Wed, 01 Mar 2023 01:53:22 -0500 Message-ID: <1328697.1677653602@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > Session 4: > create table tbl2 as select * from view1; > SELECT 0 > Why is it OK for session 4 to be different here? Maybe it isn't. The code flow for CREATE TABLE AS is a bit weird IIRC, and maybe it's missing a step where we should update the active snapshot. > It is unclear to me whether you were instead talking about other sessions > dropping tables as another way of saying "ACCESS EXCLUSIVE" in which case > at what lock level should this anomaly go away, and does it? The originally-proposed tests seemed to all involve either TRUNCATE or DROP TABLE, which are outside what I consider to be our MVCC guarantees. Your example here does seem a bit strange though. Views generally ought not have different semantics from writing out the view query in-line. regards, tom lane