Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vM1yw-00H2kQ-1O for pgsql-general@arkaria.postgresql.org; Thu, 20 Nov 2025 10:33:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vM1yu-001031-2X for pgsql-general@arkaria.postgresql.org; Thu, 20 Nov 2025 10:33:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vM1yu-00102t-1U for pgsql-general@lists.postgresql.org; Thu, 20 Nov 2025 10:33:40 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vM1ys-000X8g-2f for pgsql-general@lists.postgresql.org; Thu, 20 Nov 2025 10:33:40 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-787d5555274so6867307b3.1 for ; Thu, 20 Nov 2025 02:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763634817; x=1764239617; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5iD8eFIr/ZvYS5KBmhNacQkVy3Oy1JU2QETcOwQjDCY=; b=IRqFrdykiZJwQj1D6zizaOlzIQ2y/3HThqJvIPpQchcVaO/lOkuQP3vAhTq6hIeYeF 94Chm8T/Z1gEGRNlQnwaTgjy9QuCOeCFx+OQPlOIkFzN/fAdCEeDlTXnc1wu3UA7SE1Q 5sDWbImHeej7QDqNoNj57UQguApJw27s6ahpbEi/tSw8XwVUHz6rZRGEngLEY2il0EpD bIEsDh/oanPldZV6Id90rF5bHJ85HTR4TAnOE+erJMFbxcFdDVREWSIQKBDX4C+S+DMz q63u1v9eloJAWukfNQBgCETfkCldBWVTltGhxtyN0hUh89HrNzyPbBWvRYO+VhDAih9Z KoqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763634817; x=1764239617; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5iD8eFIr/ZvYS5KBmhNacQkVy3Oy1JU2QETcOwQjDCY=; b=evOxrkNul7S5PNGTPqv3kHs7TAMl114UnERko0u/0jyQGpxjVdMc3u3Dv9gl68sPBC jPtQcORow2WSPVpTbTepLq1DAEJPNRJNx5Oj3zPmDrLkE93zVlRcm+XVpFM0L8tAiF3j nSk4uSsMyGZUMdfmcKsqruDO+MYzHWZwAgtpM6+Q3UE9FFLBPkLMllj172zPwmUtxTjC MWhbfQkB6d97X7G8+aCKAAQlNkVXdWpCGDcCaBesjSK66TFXeZUV5KthvO5hNOMMYLhD kynYQAie3U7nifpFCbt/3uzDzkVP30kIlIdrXp9JwKezrLopI8biCZUS0kmcKiU8UA9Y lTnw== X-Gm-Message-State: AOJu0Yz4GM5ynf9Y0uxia67RpWuYjnows0n2IquafapIVtzEXZCk9DEb 5U8t8LDHoJ3CpKlEGrwWbzK2qWeuPWtWRDeznBIyBnJ5pBpxUW1C4LLJNt06OhIG86/i67Szn+J 52ZW7FohgoLtllqqLgHRB2wk7gnlKE24EvhXZ X-Gm-Gg: ASbGncvlN9Ex3AMaeIq9/smxTihVaL085s+WaM+ROpvLyvDX513gDPTgO8JEMmOc9ye l+lTucuPOmHnULznIAIv9zz4mdA0toFutcRCUzOUCpKHfyK8fzBWVcNFwsUGRYEWLDW6eq7U+j3 SliBIiwTwSF+j3VASmrPdOuurM4BGhYNYynpWcSj/DOTyJpHiC9JiaiqwhRD8w/VBP/cDAx6Drz e2f2IlzNjLdrQUvDqzxsZbL6TUPFfGYNkVDmyJnUeu0K6vZ4f8QKtK0XHGWpXNUXSbV7CGf3692 EKM6r+XQ9iHoR2rhAfCb X-Google-Smtp-Source: AGHT+IEiw4DQe5TlN4Ewh7VUlHMvi5eQs34b4+Vx+qetRcQBA5kf9QFcz7aWnWuzI0iS/Js756/LARMpcYW4VYFZTDE= X-Received: by 2002:a05:690c:22c1:b0:783:cfa0:3b69 with SMTP id 00721157ae682-78a79561acdmr22787457b3.4.1763634816811; Thu, 20 Nov 2025 02:33:36 -0800 (PST) MIME-Version: 1.0 References: <1645231.1763582658@sss.pgh.pa.us> In-Reply-To: <1645231.1763582658@sss.pgh.pa.us> From: Bernice Southey Date: Thu, 20 Nov 2025 10:33:00 +0000 X-Gm-Features: AWmQ_bki9iBH4FqWfBmuklt2ontfl7KbOU78n5HI4OMgABxsQ6r73hMvU_PlucI Message-ID: Subject: Re: Is this expected concurrency behaviour for EvalPlanQual and ctid? To: Tom Lane Cc: pgsql-general@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 19, 2025 at 8:04=E2=80=AFPM Tom Lane wrote: > > The same thing happens with > > update t set i =3D 2 from (select i from t for update) x where t.i =3D= x.i; > > Right, the common advice if you need to make such scenarios work > is to add FOR UPDATE to the non-target relations. But here, that > just breaks in the opposite direction: the sub-select blocks > waiting for the concurrent commit and then returns x.i =3D 2. > But the UPDATE's initial scan of t only sees t.i =3D 1, so the join > fails before we ever get to EvalPlanQual. Thanks for the clear explanation. When I tried to think this through I couldn't fill in the details.