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 1vdpsQ-005QeX-1b for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Jan 2026 13:16:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vdpsP-0026Jv-0s for pgsql-bugs@arkaria.postgresql.org; Thu, 08 Jan 2026 13:16:34 +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 1vdpsP-0026Jm-02 for pgsql-bugs@lists.postgresql.org; Thu, 08 Jan 2026 13:16:33 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vdpsN-005HPv-1v for pgsql-bugs@lists.postgresql.org; Thu, 08 Jan 2026 13:16:33 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-65cff0b394aso1955257eaf.0 for ; Thu, 08 Jan 2026 05:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767878190; x=1768482990; 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=hNrD5pcukLCULwPhbP/BgQ1EUAn5Aq6UOzprsG1JUjU=; b=Z5RbSs2wJ5LdgguZnu2EUQRcXJBmMbBl/obX3Sux3jXRdsmbpu3l5hcjoNT7gUZtbZ Yf+zZ7HBW9XX0MGSEG+aNgL846IkoAyBlkB9XGl7K4lN5PBAX8YM0f27Cq++aqBYc0VQ cZZfUGF7ozSpY1KSyorMakg46jNs+2xNqLDqz0CpU5aM067F5ds+Gu+r0r1N2QjRr4o/ BEuW9Hb4bo5nX0XQRhurS4UbbsYVe9cJ9zyM8dWcZb7t5OB/D7yfQAwcL4g1O1ekrW+C tB/8pS1MaoNK/EnA+XX+vQ+N/X9ZuAf74BffRs1WQaAsOuu0moOvf8+4YXOa7ytUa6Fh EPxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767878190; x=1768482990; 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=hNrD5pcukLCULwPhbP/BgQ1EUAn5Aq6UOzprsG1JUjU=; b=JFDQHg6EAVCHwh/8rLSy5sNT0c5oXPDOwPpID/801en7XAX98ZCL4bagtiAgTVa+zB pf/mygpI1IBSm8mWIcVUpmvIxoEN0BmkuK1Y1N9c9quQIDLycP0Ema0n+AxkVpEXdXwp 6FnfGkQdVhU0dNvrAkk/GzJqljZtsmUot3aa9WVjdppreNzdsNZeYVgCtWgeoXzX8CaP I8Kt/z7c0e0JOILcvcQ5Zfsq0Xcl50mSIrqEpxYmnDzQ+eaHKO59P0xUfbyVi8ljF2h7 aB1d8yk94Q3+Qrj8smRjzNdv19t0QzlabfZiKR04hdJyCOqTwgT47UbSpRD9nAFRW91Q rPYA== X-Forwarded-Encrypted: i=1; AJvYcCUqQgTfOLCiVcT7BXdJOA6MNoKmdVRzwhhdQaaZXB/YvdwzxgpvQmmJsDyH/B8w+IsjHUpVy2Wb9vBV@lists.postgresql.org X-Gm-Message-State: AOJu0YxOamG11YR3jl63nmAZUr0dGMNRkZ7WA6t/DvIcIXF/am+Gc5jP qTGEr51wDxYlTRtyOI2qXALudLr6xoEY3fWGCiOn4NUVKdlOgiAW60a/4FcI38Bd3c/pXorfkee tebFnqhpIZHeVjvOF0tn1YAGpU73yH/w= X-Gm-Gg: AY/fxX5VXVithoC0BWswBBlpxn/rsdsqw6pScrY5Z6xIOyCTc1t44bkpLAlkvUqjBSr gN2r4lrY44BGO0pyDhjLlVbBhDrjg1PHpj5YXRLN3aFkAJbA5g4StaXm2+Hd8OTh1qj4hWXRwFF sy5DxPd4tZcu0H9FwwscFsx0GqJS2K6l2KcPvlTffsvLLv3RO0PfAousuLQDxRKwm8tr+v6o7PQ FOCWR6er40FM/yaZD0pz+BSCURaps+mM+coXPpZ4H7bfiv15UM3c0wElOBylG630xvfDCg4 X-Google-Smtp-Source: AGHT+IGbDiCFRuYLVDknF63xVg+Gls5R4XK7EidN/RCycKwrgh1MRKSv+t+GlyiJ0o4dcNxZTa5HGPq+8SGk8cwedgc= X-Received: by 2002:a4a:d15a:0:b0:65b:3797:6536 with SMTP id 006d021491bc7-65f54ed455cmr1811050eaf.3.1767878189570; Thu, 08 Jan 2026 05:16:29 -0800 (PST) MIME-Version: 1.0 References: <19355-57d7d52ea4980dc6@postgresql.org> <868ff2a518820c8864b6d28510294b2457a126af.camel@cybertec.at> In-Reply-To: From: Amit Langote Date: Thu, 8 Jan 2026 22:16:12 +0900 X-Gm-Features: AQt7F2qmrLVtiigLI8gXj2MLak6-Gg-gL_4WFRLM02u0h9i-CyW0LHnJ3kds2d0 Message-ID: Subject: Re: BUG #19355: Attempt to insert data unexpectedly during concurrent update To: Dean Rasheed Cc: Tender Wang , Bh W , Laurenz Albe , pgsql-bugs@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, Jan 7, 2026 at 9:52=E2=80=AFPM Dean Rasheed wrote: > On Wed, 7 Jan 2026 at 09:37, Amit Langote wrote= : > > > > Yes, I think the approach in your patch seems better for the reason > > you mentioned, at least for back-patching sanity. > > > > I intended all of these relid sets to account for prunable RELATION RTE= s only. > > Yes, I think that makes sense. > > > Thanks Tender and Bernice for the additional analysis. I prefer Dean's > > fix-the-executor approach for back-patching. Bernice, are there other > > related issues you're aware of beyond this rowmark bug? Want to make > > sure Dean's patch covers them too. > > It looks to me as though either approach would work, so I'm happy for > you to decide which approach fits best with your design. Ok, I thought about this some more. I admit I'd be lying if I said I didn't have doubts about my original design. It might be better for PlannedStmt.unprunableRelids and es_unpruned_relids to cover *all* RTEs except those that are prunable (decided by the planner) or pruned (decided during executor startup). That way, code checking these sets wouldn't need to also verify the RTE kind, as your patch currently does. If we were to change the design, we could remove PlannerGlobal.allRelids entirely on master, since it would no longer need to be selectively populated -- unprunableRelids could just be computed directly from the full rtable. But that would mean we'd be leaving v18 with an unused field in PlannerGlobal. That's not great, but having different designs in the two branches isn't ideal either. So I'll go with your minimal fix for the back-patch. We can revisit the design cleanup on master later if desired. > > Thanks for the patch! Do you intend to commit and back-patch this > > yourself, or would you like me to handle it? > > It's your code, and you're more familiar with it than me, so I'm happy > to leave it to you :-) Surely. --=20 Thanks, Amit Langote