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 1pzlGs-0000tp-6z for pgsql-hackers@arkaria.postgresql.org; Thu, 18 May 2023 21:34:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pzlGr-0005fo-2j for pgsql-hackers@arkaria.postgresql.org; Thu, 18 May 2023 21:34:49 +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 1pzlGq-0005Wc-Of for pgsql-hackers@lists.postgresql.org; Thu, 18 May 2023 21:34:48 +0000 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pzlGo-000YXq-3p for pgsql-hackers@lists.postgresql.org; Thu, 18 May 2023 21:34:47 +0000 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-38ede2e0e69so1412190b6e.2 for ; Thu, 18 May 2023 14:34:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684445685; x=1687037685; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=gtjcesP3Hf1nUubUdo0kPa9Irzc3dJykb/Ua0ocs2wU=; b=cvJgcfSrsB30FhWS1GXBSpIq/AvUhPPmKLN19PZGaxw/4LPazcnfE7ZSav8pM2kTvb BxQ+E2BwVt8HJAAzVbBCRoYYWtQsSXoW1c1/Vm1G/2HrCC32XOvnmMQ0sF/bRWJ57hHL WnIQQ89GMqCHUefwZHKWxYjhdsZU62A2U/muno7BPSsZRgKqClADCjS7wTqwnRjzFzd6 lfsvWmBIICAvaFWdrvvVUlG2sryCpJDOfptjksJvoM07pMQui1R+lZwCaYjiEISnrEFt UvwisGtlbPQv8jG8fAFXU6HB2CnkX1QaHkIkFOu7MYlTkUoDhYrcHiKtVkrm+qNXC9+w eSYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684445685; x=1687037685; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gtjcesP3Hf1nUubUdo0kPa9Irzc3dJykb/Ua0ocs2wU=; b=HQPHmN7cR82BxADXAAAIyHRPZ5AxEKWkx7CQqxMHDX9kAmcXVjO+HMgTLU7v0aRkCY HqDtu3BRMIyMvZhNBL169Ukhz/3BgnxHCXKecIxh4Jt6+xN/IR0oWjM7wZMUmXyO1lcl A3xym7Ox/DQgjnEmET+URNqtLXYNTv5VRqinmGSCNSJomwA/ERVWs38emsH5jouFE3Cn /4DpiTg5EP2qAggX1hb2b2fbG/uwAHOQBVdbM0hw6abWs/lX+Wi0SWfsqmuDguuvGM3v 3jZ9qxHccrcv7QwKdX/nRAWKNlIN+cLLgtynuuuVSL7R9XoU4+Kc2kuYsY++M2f17nrZ t3Sg== X-Gm-Message-State: AC+VfDyMm8FKf6CifN48eWU+gD/eu8ga9phMeqc8Edyx/bbMa7h7W0dr OmDznVfkHEp4XDJeEvn9240= X-Google-Smtp-Source: ACHHUZ4Bq6cdtKWZj0MmiwzlpjBvBwzwo6T79vNdvSMLf3KArSyR1I8L04KbEtseowt4SnBs8ZtCMA== X-Received: by 2002:aca:130d:0:b0:38e:b9b:a85c with SMTP id e13-20020aca130d000000b0038e0b9ba85cmr57903oii.53.1684445685412; Thu, 18 May 2023 14:34:45 -0700 (PDT) Received: from nathanxps13 (162-195-170-173.lightspeed.stlsmo.sbcglobal.net. [162.195.170.173]) by smtp.gmail.com with ESMTPSA id m125-20020acabc83000000b0038c06ae307asm1060137oif.52.2023.05.18.14.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 May 2023 14:34:44 -0700 (PDT) Date: Thu, 18 May 2023 14:34:42 -0700 From: Nathan Bossart To: Tom Lane Cc: Aleksander Alekseev , Amit Langote , PostgreSQL Hackers Subject: Re: The documentation for READ COMMITTED may be incomplete or wrong Message-ID: <20230518213442.GA3364784@nathanxps13> References: <3794290.1684421615@sss.pgh.pa.us> <3798164.1684423374@sss.pgh.pa.us> <20230518195123.GA3362715@nathanxps13> <3880859.1684440216@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3880859.1684440216@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, May 18, 2023 at 04:03:36PM -0400, Tom Lane wrote: > Yeah. I see the problem: when starting up an EPQ recheck, we stuff > the tuple-to-test into the epqstate->relsubs_slot[] entry for the > relation it came from, but we do nothing to the EPQ state for the > other target relations, which allows the EPQ plan to fetch rows > from those relations as usual. If it finds a (non-updated) row > passing the qual, kaboom! We decide the EPQ check passed. Ah, so the EPQ check only fails for the last tuple because we won't fetch rows from the other relations. I think that explains the behavior I'm seeing. > What we need to do, I think, is set epqstate->relsubs_done[] for > all target relations except the one we are stuffing a tuple into. This seems generally reasonable to me. > While nodeModifyTable can certainly be made to do that, things are > complicated by the fact that currently ExecScanReScan thinks it ought > to clear all the relsubs_done flags, which would break things again. > I wonder if we can simply delete that code. Dropping the > FDW/Custom-specific code there is a bit scary, but on the whole that > looks like code that got cargo-culted in rather than anything we > actually need. I see that part was added in 385f337 [0]. I haven't had a chance to evaluate whether it seems necessary. [0] https://postgr.es/m/9A28C8860F777E439AA12E8AEA7694F80117370C%40BPXM15GP.gisp.nec.co.jp -- Nathan Bossart Amazon Web Services: https://aws.amazon.com