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 1wXc45-003Mrs-2y for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 09:51:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXc44-00FVPL-2Y for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jun 2026 09:51:08 +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 1wXc44-00FVPD-1b for pgsql-hackers@lists.postgresql.org; Thu, 11 Jun 2026 09:51:08 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXc42-00000002VQG-1rui for pgsql-hackers@postgresql.org; Thu, 11 Jun 2026 09:51:08 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-68d232e119dso12463507a12.0 for ; Thu, 11 Jun 2026 02:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781171463; cv=none; d=google.com; s=arc-20240605; b=hfMafeNYfov1VgGP7FB8ZpfMtN9yzGwyrShOu1gVbGpnYmOK4CRe6+CaB+7cf23oVC x1Utyg74db5kICYdhPm5m1OOMnb4WrnIA7EwF4V3dFIFHygyysoBzw3hjRCXp/MsKZnM wsAiTHAJH+Nq28ikafne2pbeM+0ooKVPVu8/LGo8sXaGWN1A5LArCzY2h9JUWMQvWHbW tLwoL5EII7iUGHcwWC1Cx/XMnkQYHpd/PuwBVlwK6JRbWn7PtsxSMQGdzzYPUhaDnoK6 ggMRHX4YMtf8EwTFJ2ZpX5E+UcJXwKw6bk+hTrvOPSbVVLc1xEOgZIiQBwuPwRFkuMGg V+7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dpjnrcjlQUEbCd7LLwuOmLY0orEgISIO5CTtuxrYEY4=; fh=Zd8zi+UScSmu2lGgf6EAWEj98vfHb3+5iqpqFg3aCEk=; b=a7ECHqR9sfOANbFNgHV+vcoEPDHz1K4EdRRBvDJtgH6w2qtUEw6EIRuzLU1+hiV4E8 utkwRD5PzAFOam7WFuO7AgGO7Vl7EXXfaMbrUZ0G5U7AQMnW2n11DPXXRtgWnrPQ7/6I SOCaBYcCcRFMUQoonJa6nyNReQIIxwWb4GoUmQ7xxgaHDvRfE/bjjdU4KxhAQbqNsHon Ck5YkKV1+WCLbcog3aQQI1BF4zo/nTmDfMAPTgoSfR5XBz6JyEkvmctmQYftG4+p0AbR R3RWnDuK2Rh1WRsoRE0E1kCQVCQuWqYWIOxFC23yNmxbwm0n9hA1Z62T9biFohx+LM7q PhTg==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781171463; x=1781776263; darn=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=dpjnrcjlQUEbCd7LLwuOmLY0orEgISIO5CTtuxrYEY4=; b=XN2Vlnqarlx3q6TZ7KaFzK+K2yxeWb3fkbQUSdwu3WiYq0arOwgUG6Wis1NVmJ0ncO WsGABi1Vy9GYFJ/SaBDLz83NNCUluZSEVOYmcyOhTuPvo8p1ZirijijAjux/wQnUXjDk 8jJg9cWhBVG2WQFFP2tqPdTg97DW8WnKUEkJZlO1f6OZ7InbKOAyhHLkOXIrnkM4yE20 jMOFQSvO++fRXXMozdmLNLhp+m8U5BMR9fMYpn4aExoI/b4J7F5nYMBoYEAa1HM2aPv6 aN0o7woxb2ZMyiQAfd3hWSM6poEmXIPJy90Ne5+t42VY01/2kACt+ZxTU5AAOhzXIah1 hGBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781171463; x=1781776263; 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=dpjnrcjlQUEbCd7LLwuOmLY0orEgISIO5CTtuxrYEY4=; b=KMIFO6gEgbZAHWOkV0BFS5eDRufqSHZjifyoX1spQjF5CBuW+lKveI5HcjsHCGhvcS ixunf0H+U7CqH4L89s5eM55q/neGn7Ns9JkkBp7hG4LVuajfW24N6UiqYxyTLWI44y/L 7A+i+iat0LquGaWxRzs64+t1ZIFHG3Q0gFiQ9nNj+J0AcG2Q+7WoYcR2zU8qUMxffHxu qYwskQhLSARFIMUopvmP650BSnNZVNShm/aCqirHl1zsaxXTyiX8Oakd0j0eWT78C4YX TnK1YPwAIdHxzxtA3y+ZBXTVRmezGN5cPne2hw80hrkN/V3ElDqVlg+BOaGTd/jwbXpD XiSg== X-Forwarded-Encrypted: i=1; AFNElJ/iNacyZba3Fesi8NxlKMyWvSUJhNd5QWb/vHnGnB+C78vOFKQjfs+7VUEcXVyr10GvkcHBtC2H4X1Zw555@postgresql.org X-Gm-Message-State: AOJu0Yw0E91ppLhqsG4xZXMJcHqMAhhNpaCnQoRNjYoQWxGTPL/gBBa8 y3AOODm7Inw5fgle8l2FVoMjFO/Mlzg8c1P8KX2Oocuip7fEW3ItKHG1To/0+qSl3ECN+Wsiizr h6K5n1gR04PPE30SAVpEGYnx55bpfRv8= X-Gm-Gg: Acq92OF/AiHygFxXlmF4iVeU/Y+xNSy0Or7aoeX8GyQVot5GSBs3nSC9vIRYTBjfHvz XvJFh7h0xlM+ou3YD9gT9W+YSgQXnMQ3bJlUDCwOHaDsb9/wYiQhAAiyXjXHmRfMirLulhd8wn1 9wzT5j7QdKRLVCFY1rcZ3nuvDR7qr4PrM3CeLN91NrlBLMQlzk6A86ZnMINHs8Ny5L4wA1C/AEF RapAB9J9v0oUrVNAUYV9JSBr1N75VB8hPY4Ec5wpAhCPT2mK+jm76sSmCcWBWeLXW8+56zEkMjV rUZRy6qYBRu+KyqVq7a1fTEWq1q7XJTQbIDIlpcPbGn3xlGmhmAWnHnT/BNddRGb8JEv4FDBbZ9 fDd5t X-Received: by 2002:a05:6402:13d6:b0:687:3580:fc26 with SMTP id 4fb4d7f45d1cf-6930e2b7190mr1038582a12.13.1781171463013; Thu, 11 Jun 2026 02:51:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Junwang Zhao Date: Thu, 11 Jun 2026 17:50:51 +0800 X-Gm-Features: AVVi8CeIuRBx-Rw0b6jHDUCf3A7k8yFfV0Al0__bZRKmRXGoF_hYRxZ2tDe99H8 Message-ID: Subject: Re: PG19 FK fast path: OOB write and missed FK checks during batched To: Amit Langote Cc: Ayush Tiwari , Nikolay Samokhvalov , pgsql-hackers mailing list , Andrey Borodin , Kirk Wolak 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 Hi Amit, On Thu, Jun 11, 2026 at 5:05=E2=80=AFPM Amit Langote wrote: > > On Thu, Jun 11, 2026 at 5:18=E2=80=AFPM Junwang Zhao = wrote: > > I only reviewed and applied patch 0001 on my local machine, and it > > successfully fixed the crash. > > > > One minor comment: > > > > + if (fpentry->flushing) > > + { > > + ri_FastPathCheck(riinfo, fk_rel, newslot); > > + return; > > + } > > > > Would it be worth wrapping the condition with unlikely()? It seems > > this branch is expected to be false in most cases, not a strong > > opinion though. > > Good idea. Will do. > > Are you planning to look at 0002? I just applied 0002 and ran the regression successfully. I have one trivial comment, subXact abort doesn't NULL the ri_fastpath_cache, so I think the following comment of RI_FastPathEntry should be polished accordingly by removing the `SubXactCallback`. * ri_FastPathEndBatch(); on abort, ResourceOwner releases the cached * relations and the XactCallback/SubXactCallback NULL the static cache poin= ter * to prevent any subsequent access. > > -- > Thanks, Amit Langote --=20 Regards Junwang Zhao