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 1wFOpJ-0053bU-31 for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 04:04:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wFOpJ-00BctI-0R for pgsql-hackers@arkaria.postgresql.org; Wed, 22 Apr 2026 04:04:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wFOpI-00BctA-2Y for pgsql-hackers@lists.postgresql.org; Wed, 22 Apr 2026 04:04:36 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wFOpG-00000002C08-30vH for pgsql-hackers@postgresql.org; Wed, 22 Apr 2026 04:04:35 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-35fb7c1a455so1977072a91.3 for ; Tue, 21 Apr 2026 21:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776830674; cv=none; d=google.com; s=arc-20240605; b=hA5Eetd66dTKQLGui+XPJGN/Dg6D2dRXE05FZ1GTyPcHliHQARD00DZvFVVBFpTzsG 7oQIY3y8msN6rduXmYWGZnzd6NNzM594lbjfhRuAP1vPdNo7Nh/YSFPYkweqk4sWXD68 aNmjOYTXE+H3Dx2YwqbDyStdxO0EBiUKJOrqGulBMdsUgIWlWAcz9acQIumIMPtRUb8X wIVTS81mS8DXz9ELhAsb7A+nnJjGuKXUiVENvMeHOMKoOD5RaIcCGR/ywQyA/c8P2P+G N352BWjKYs+/s1zKFMkAAhu6jedA+9kLK1wQOQJBkYQZfaVsVePD/NPGDnT27PnVoSEG YMaA== 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=cCHkT5CiPYdcOR4JSwDMgqWflHEdxZlsHU2y66oQElk=; fh=Dsr9hS5VO1e9h3v7/MDZlCkgTEnz3boC/EwkWS3sf1c=; b=YqFaAbcv0iXom8ypx9d/N1SOGEKWyzwWls58I75RnasVvRI1pJqufdjt9i0vaCzMVa /A7lD910xkkt42Sv0HOn6mefhu7x7Eje92byfXt8PYACyTQ3GPoZrIhezy2KB6Y7yZn4 y9C9/d0g0fN5PmEgRA8Bofx/fFIFIXiRop+XQakSeaJV5qim0jfTN7Q2UJ3LlO757Dfc 5Pkb/G4w4BU/HVgygG/b2i/2w7omow+e2XY3YDz1ECsZFFoaXkjDBmP6u/KMcJ2Aso2o T+u9eoJuOz0HBVMIt8Cx8e6j2r2hMA6F+5SSQXQoOcNb7jr3yhBBS8LIj6bIJQWNenyH QmNw==; 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=1776830674; x=1777435474; 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=cCHkT5CiPYdcOR4JSwDMgqWflHEdxZlsHU2y66oQElk=; b=eHda3knzDCd1SKxD9j01plu8pd4QC8PGa2Hs2e3L+DEgRc94T1BavDBBh65GQ1JAe+ mYfVJ2fquiY1bmXj43ruHdJo9mmb4c9SucxyaMimLOmBEMEaglzFrW7o6BXHp6+aD4am 5xdsymLZ5uo/4pxwOnMfyI6in+ngAmQgeWwNvRm6Kjqq8njEeCeq/YYRsUOd91fwtg5E dHy9S2vaQJ5LD51uYCEIOSxfn1j+fyozPR+CibKY9w4kOpzsAHqWdPxXf3sM6aojI1vf mdkryyWMVwAv/N+lwzVqnoYwQdV0UpWzEX7UOCbvGpSJa6uw2HUhDTfOOp54GPeTHxjc Sy2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776830674; x=1777435474; 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=cCHkT5CiPYdcOR4JSwDMgqWflHEdxZlsHU2y66oQElk=; b=fP65/4lx6EyJ27cIieGJttYHTiddNqB9gcZIby0BND6Mf7PTobiU+ZihHf2hJ3BZf7 uhvIWzFC0zmLKQtQ9QxwO0ENoSdB1bt2Lzxm1dNxNLKfdhYVgiwk85SphuMW9d1p5ZvV 2BLjs5nlHeMcI/CD7F26lREVcjE/QHKgAEccOrMPIt0lSL/4pJSYlQ6eqS1tJWbNoWu5 PKJkox5amR7Ms6tRpUG8yrIWzPSMMwDbIGUL6CxgrAjFE+MDwSP1Wg/9G8euaZJNipgi GKIUSbQnVRoE7/tMiijOBx2HzU3rro/ITKcWF3wberu4HilUs7CvU2QwnWAtkjxzlcV5 Nzlw== X-Forwarded-Encrypted: i=1; AFNElJ+Y9pQVSTKWQsGH0VzYTXfY5MC/i5xiJ9uI2Sj24kq5qli4kYPIOaSuctIa/HwjUVa80199+8xN+nIEsT56@postgresql.org X-Gm-Message-State: AOJu0Yxmf9FGMNozhgQ7hqLeKok1LfI9IlZhVoXssmP5KfUFy8w2QQRE qS0V/4/Xm617t6rgjrLm8GDZeMSEzzcCOiV+5FjEKHVrcbzdrAPqE/l0zmVrJRyVaIVLUvx+f7b pMSnC1/MiTH93fNP07cGZHa28ckGw/B8= X-Gm-Gg: AeBDiev21tJ87VvVj1rlAFhwF7zDEY0RYIrzlTjpCeneDdIoKKa8IcMgfQNMDk3gkRL Uvze7qQTdZaYsckhkIjJXWCjA49526VoHq/I6a5WXfv9rrh8IfnBDQ7fr/fHkOXuRdlQBog3mqF 5N5soNwL06NAlohswTl14KCkoDQ0Xd17grYpgTEeTcMPpCHc3lLyvdd1R8HIr0kJd2yj3DZA4Rw u4tCYjVEWwDrwDUrq3r0nGmRvAmAQ6vywh5hQ41fJ9ofr9iq8/JNB7c7Lf1oC5fv+3ChiSNfmqY 3lhA1SFfFhTLhyyjEZh1OJRh5qES1hezih094ECWeAJuY52TdeE3YbLTLdeiHippejngAEgxjbL ChmumPOBEAg== X-Received: by 2002:a17:90b:5185:b0:35c:29ba:bf92 with SMTP id 98e67ed59e1d1-361403d5988mr22296921a91.5.1776830673992; Tue, 21 Apr 2026 21:04:33 -0700 (PDT) MIME-Version: 1.0 References: <77FA04FE-1F84-4DA1-8855-8BBFD8CC889A@gmail.com> <548600ed-8bbb-4e50-8fc3-65091b122276@eisentraut.org> In-Reply-To: From: Amit Langote Date: Wed, 22 Apr 2026 13:04:17 +0900 X-Gm-Features: AQROBzCAYe27G8ERpUd277pzLjVSqQexGAZwC19Q2KTQMkvUal7u-37D_BW4_Qw Message-ID: Subject: Re: Eliminating SPI / SQL from some RI triggers - take 3 To: Peter Eisentraut Cc: Junwang Zhao , Chao Li , Haibo Yan , Pavel Stehule , PostgreSQL-development , Tomas Vondra 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 Tue, Apr 21, 2026 at 9:52=E2=80=AFAM Amit Langote wrote: > On Tue, Apr 21, 2026 at 5:50=E2=80=AFAM Peter Eisentraut wrote: > > On 02.04.26 09:41, Amit Langote wrote: > > > There's another case in which it is not ok to use FlushArray and that > > > is if the index AM's amsearcharray is false (should be true in all > > > cases because the unique index used for PK is always btree). Added a= n > > > Assert to that effect next to where SK_SEARCHARRAY is set in > > > ri_FastPathFlushArray rather than a runtime check in the dispatch > > > condition. > > > > > > Patch updated. Also added a comment about invalidation requirement o= r > > > lack thereof for RI_FastPathEntry, rename AfterTriggerBatchIsActive() > > > to simply AfterTriggerIsActive(), fixed the comments in trigger.h > > > describing the callback mechanism. > > > > > > Will push tomorrow morning (Friday) barring objections. > > > > This commit contains a couple of calls > > > > ri_populate_fastpath_metadata((RI_ConstraintInfo *) riinfo, > > fk_rel, idx_rel); > > > > where the cast casts away the const-ness of riinfo. > > > > But this is kind of a lie, since the purpose of > > ri_populate_fastpath_metadata() is to modify riinfo. > > > > I think the right thing to do here is to unwind the const qualifiers up > > the stack. See attached patch. > > Thanks for the patch. LGTM. > > Are you planning to push it or do you want me to? Pushed. --=20 Thanks, Amit Langote