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 1wEzMd-004dma-1m for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 00:53:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wEzMb-0055Km-2u for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 00:53:17 +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 1wEzMb-0055Kd-1j for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 00:53:17 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wEzMZ-00000002DSW-1If2 for pgsql-hackers@postgresql.org; Tue, 21 Apr 2026 00:53:17 +0000 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-682fce74c06so2955144eaf.3 for ; Mon, 20 Apr 2026 17:53:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776732793; cv=none; d=google.com; s=arc-20240605; b=LFehRirUk6oEtEZWkfyDYLt8Dfl4g1X6GuMOWuhmvOI359HVXr2+ovPyajRMZzaBpX o/YpGaghclrkxuDg8ITLF/HS+QzTxHsslCbpwzCDNi7qBRjdkrLb0f4LSVUGEBuma5ZC pxeEXj8HjvRx5sCPzpa2wYenb4lzhVfcIWjlEs/E3luHmpWKIBSLYDQqPYzLqaug+nSf cDxgpAebtERuarpyIbo7mkT3xMLq+yqWpGE70+0dUYw31NxH4/Vlpw+XVOJ3oCOfNg0w ZGA1qcYueGfdM8W2bEsKi07TiEOKFGK6TaeQ4lU04eY9Pg+6GQRfCbRypM6YtqHIENGJ jhpQ== 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=IVkM2C9+X0qhdQqZOoWXrH23NIHCh6w8X9ZpbJBw6po=; fh=ne6UgFGP8Tr7/uawBOPOo4XRF07cGhS6RLrgksxtjgE=; b=NthevpaoaorGGS/t9x1g2NDaJVzAda7j209x2UH0IYq3f8EwEfhpq1JB0oIXz1Nsdo T4W8kf28kSCZzwgxApQd9CcfURmCC/tRIRjuQhERjX152TstxjvzJAEjZ4fmXW775dkx pFqHZyESOzB8vPaqOLh3lqLb+Nc6K9F/ZRy+ApIsF23ASg9tRwWL8eQTHfkr8BgF1H05 HR7wygGA5KaOHd5rPde749ldDfaQJNggblROql2tZt2Sgpiy17uf+iXhvh/eFN0lWrS2 REYFBCuPkCLjpfIyePqEv0FkD6cxlW51tuEf3thsc25GDXcP0O4AlmIRmkrwMD0Lmif1 jRdg==; 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=1776732793; x=1777337593; 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=IVkM2C9+X0qhdQqZOoWXrH23NIHCh6w8X9ZpbJBw6po=; b=mDLbCniq2aDlzUGFZLZvFoEdlJI4fNMwKsliRRrmJRh339Qm8ctPjBp+qDNS5pG0l8 n7Kwr9aKxmIU34a6dhquHCOXxGNtuvtEHpQaq4M5diLU6xuAT2f2YhLB3aBeIruLTK9I jeEb4kvYutIyeWAbAxiM8mX81yxYufjKNCyY04Nhe5E0vYvRbphmCsRrKwgRQOc4RNYU pXtyk+5TUYhIthciXY3gJanRMNhIYn9rpYWrHgUprspxsGF1gVhwZ8JyLE+//qeOEh/X 2/eggZ0l6itoket3Ul4suHcZs96f80TLsV3nUtdp0gQw/SJd7ab2yJuLahpAcYqkzg3n B/rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776732793; x=1777337593; 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=IVkM2C9+X0qhdQqZOoWXrH23NIHCh6w8X9ZpbJBw6po=; b=csX128xZ7RuI8MkVH4iPcaw5/AMibUVgzf2uOuF22rzX5Q1sq0+l/b1e5pG9VZklnA KEyXmr7iYSszzOHs5yEBckOr4gSVXa0s+PZ9OeBJdNLGeaCAHHOelwK1FaptBzqECjHQ hj27yPHP+1P2Xk717v1oKkRhmYuNAC2+qkmB68zGR5SBKbCRUhIRFMareVwAzHpI2Dpr +R7C1tUzRFayrNIrHPld1FBhuzEwqOmhbJqFY0vBYPEdmR4SbkK3IxmfZo6XU21rYY0B elT0PxoBqz6fht2aHxEE5TLROrv4PxsNd4hHzHDKh9w1nQlm3Ffoaj1TBaHKNE3MwION JShQ== X-Forwarded-Encrypted: i=1; AFNElJ81ALaPn4APTrCc+bzFI3EvWVOq251aLON8xUbdRgECIknWjcYZ+1tguFSYhBo/dl5loraRYCT8Pc/JmjV4@postgresql.org X-Gm-Message-State: AOJu0Yyl74LtDpQzBCBGUckO3EA5JDNwN1xpg8tabMUcnJcfBOiB9fGS C8CVcGpdHNvf2JAufRHqq91wns7jbrH5KGtfkxyl9ENrpmC465u3vwVXJ0+qUfKh4XHXR9LRRrw 6pkKWk7Rh6VaKCtoRfMsAml95Tz+XFNs= X-Gm-Gg: AeBDievMD8nN76/ZSaqMmBuRPTvpSa/oeT4XdIYYPhek3esWY2QEXZeN3cgpDZ7sfus GEBxLTiQKgtOwAku8loUNuFEKGPsQa7Ds8yajj2zPXYOVQY81chjECOYFTTDd2APA4I8NGD+qw6 B5/vde2m+gpMVa+DGdAG3IVv87ljL4TkYz8m/Ef/M6iSLSJcgq7o1nWc+up717rdPlr5UhBO+1a 4+RZaAEqrjgB+CIpXfI4m54V7vRzS1n7TwStRoK5oOD1sStlF+ajkQl1pW0XMnMWm6pW3qR8FWz mfKgXf4WY8eyax6OwQsMlRiafFKdaJ56bNLyHNI17Lr4mpSNI2kLO55G+kXZNBQiGgGxCvagoVc = X-Received: by 2002:a05:6820:80e:b0:694:914f:c18f with SMTP id 006d021491bc7-694914fc460mr2031312eaf.3.1776732793050; Mon, 20 Apr 2026 17:53:13 -0700 (PDT) MIME-Version: 1.0 References: <77FA04FE-1F84-4DA1-8855-8BBFD8CC889A@gmail.com> <548600ed-8bbb-4e50-8fc3-65091b122276@eisentraut.org> In-Reply-To: <548600ed-8bbb-4e50-8fc3-65091b122276@eisentraut.org> From: Amit Langote Date: Tue, 21 Apr 2026 09:52:55 +0900 X-Gm-Features: AQROBzAIn_PgDfzRej99yHBrGC3i-slwQVwZvHE33mpMMgUzwscovDPRlxGfCxU 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 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 an > > 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 or > > 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? --=20 Thanks, Amit Langote