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 1wCtMC-002P4S-1i for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 06:04:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wCtM9-00Ese7-15 for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 06:04:10 +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 1wCtM8-00Esdz-2x for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2026 06:04:09 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wCtM7-000000015qd-359i for pgsql-hackers@postgresql.org; Wed, 15 Apr 2026 06:04:08 +0000 Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-356337f058aso4177176a91.2 for ; Tue, 14 Apr 2026 23:04:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1776233047; cv=none; d=google.com; s=arc-20240605; b=HAwSynA9cmFMiDriJG9gvX3pjnmLUpOHItDEuYLRrNd0arcu+TgwEUIiJnU8TaPCUp zSDQuE+3i3BoPcgMbT54hdtLFRAuHNbvmpoImAHOc2SpgDNTq/qY/+wUgHJZfe4/uRPk dKR6U7blWl59l1SPu9IWTHzBTZVp1qxnjTqsFkwXfyWawpa+aO3CdZSNrzOELNuoKiuf iE4/R54d43b2vRPuwHIcAa5CB6OEQqSDPDJ3F1R+YrLNXDPOEGM2cOtwHqxQfVHotjtF iTz74I+bzzF8wAa1+olfOB+Gy9A0T9WikVtCQ6Ke/YKGYPTniYSqflELzYDbp8X8LQY6 Zq2A== 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=zkiv/5aFaEmYPPSa6A+7m1UxcgiBuzuHjPJ8FpTGy44=; fh=fW2W/P0+zah+2/k9LBTruqEsdeUu+4dvmoQmalOEFhQ=; b=gzf3Px4jJ2ntQud9uD6I3aHrnCUhKluPeHbmWbqszdJJEseNM8eMLJ9MxzVDCGjwWg GJEK1dP7d0FD6qPjgTdcrfH3oJp39tkXDrJf3DTVOa4+FbdH3+ueTABxHKvGJNn2K3h+ Z/u+eIOmLNV2Idr7aIwLdfIEYNO0hvSBoDqC6TlLVBLuhuna65oD4a0baHS2bGHjo9em TrNVdAi14S5k4Vf3LHzuRFn7bkjjSlCZlHH+sb2Ym6qNyiPUcBE8PLSG7EitvuL44ANY qvQO+ND9kaUh4mpI16nqVwOaJ5epYM6C50NEyPZr3O/a4a4Vw4W3WlIfuA0FwA1OIht1 Kjug==; 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=1776233047; x=1776837847; 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=zkiv/5aFaEmYPPSa6A+7m1UxcgiBuzuHjPJ8FpTGy44=; b=kGFLWe7fzssjRetPUV2GGQJ7LJqddwF7J81oxDg+RI0GhwP/KPwvUtHio0HiS/ih5A R/x+YD/8E3Y6CDUwW5D2P6xrziUz7Ach8sk6zIC5OxBzm35f73w8ESvxXcB42mcEBAw4 HDQ9xupMggVvtjoipMoQq7sw3bSmIii24+JBx6dHLVZ08U41qk7JVsP1ZnvO4Gau3Ujd bnYHydzMJaoYiPst9sT8wAn8oK6MfIoo5AqcxxkjaofI5tY3yfNcfhnXnmwstnj4Njzu 44nxQMyXv3ixs+HaBiFKIaylx1SR8N8V9C49WnL6ay6XTY5JnmAPCdhruA06d7wfpfWz Ldbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776233047; x=1776837847; 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=zkiv/5aFaEmYPPSa6A+7m1UxcgiBuzuHjPJ8FpTGy44=; b=EqwnJ4AMdb6GiONz7DhgBxrOZexuVN0el7eE61l5Dvw0mB0gO2aEBBQUB5RQcRlLqS rN8/b8Q+mWG4zFW843BAEraqdUampR+3PClPJF37r0k5baGzsuVWoOwz2j00DxD5Fwuu dCSa8DbGjOqFDiSb/xwE6R1Wm417Qn4y2DMfhHL4J+sj0GpsPzCzeG2oRJNB33yr1NK0 JUQLnlcPzEU5rd5VGklzg1IUSKCjijV87YKG421yYsoh+rhJW/4CiSwDahjchYg+KbRo azJ8xF/7eIXuoMOwUewtFyIS9QnsS2n4FkcMCSLVvMVH7NGVJPFGhzhohFudO9sXW6aE VDCQ== X-Forwarded-Encrypted: i=1; AFNElJ9orHBKU0C5veGk+xbEauWwV/R93BSLq4L16S3LPnYnA6c8q1519BoAOwKRS0405COZOxiCw+5pGsIi5D5i@postgresql.org X-Gm-Message-State: AOJu0YwnVyzN/MLB44PfyHXVM5F3WCWe7W8RgEEgcnHuspR0VaLl1FDJ g5OXbhn429TTLCIgnTaUTKscDbRoRbn4NgGqlGC/DtCG7nkcFp3CyqutQ2ntq7P1vhMhnPJ7kyr qsQxvFKBhsLZreiJs/hl3hc8ZRdI7jT/JGunW X-Gm-Gg: AeBDietk2TK7L2rYtvkDd50mf7hUKuQMiM9Woem++P3W09fsLE3H3Ug3i/frrL0Pl19 4r2bUzEU0UwggSBexiCwvm3miPie+sP2cpC2NcmS0ceL214T5WQz2MR2Y76gAH0RDeUt7i8mT6/ xsg/AtRQ7CbwRXFs2Z68D0EC2BAKlwSuIbNDCjDndrFlO02OQ1USHDQXIZSTHQ+iIbAPtF88oNX KyqLrUaxUvkn/PRaYnQ6gWdItyr0v3pO2QKO7aTog5jGMrPI5SRKAkm8cZu51/cAj/vjFa9G7xl ZQDKpz7BuC+kguo4f74T3MT3sZxDqb+X6/hwA0PSQIO/Ni8t+mTMi1+4871Uir22 X-Received: by 2002:a17:902:7886:b0:2b2:5042:dd18 with SMTP id d9443c01a7336-2b2d594152bmr152421565ad.3.1776233046982; Tue, 14 Apr 2026 23:04:06 -0700 (PDT) MIME-Version: 1.0 References: <2BE661BA-D909-4093-BF78-DB9B0C099337@gmail.com> <77FA04FE-1F84-4DA1-8855-8BBFD8CC889A@gmail.com> <72AA2663-B642-4FB1-BDC2-5FAFF2D2DF15@gmail.com> <8561287B-19F1-421E-959D-99F4593CFF54@gmail.com> In-Reply-To: From: Amit Langote Date: Wed, 15 Apr 2026 15:03:50 +0900 X-Gm-Features: AQROBzC_aKryZ1wXomB6oNVdJqvF9MwJ87dJLSGNnCPX7Ld_Fr2l6SjgZvEaZWI Message-ID: Subject: Re: Eliminating SPI / SQL from some RI triggers - take 3 To: Haibo Yan Cc: Chao Li , Evan Montgomery-Recht , PostgreSQL-development 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 Sat, Apr 11, 2026 at 8:34=E2=80=AFAM Haibo Yan w= rote: > On Fri, Apr 10, 2026 at 12:39=E2=80=AFAM Amit Langote wrote: >> Here's the remaning patch to add src/test/modules/test_spi_resowner >> rebased against master. I'm holding off on committing the test module >> until I confirm the policy on new test modules during feature freeze. >> It's also worth discussing whether this is the right place for testing >> C extensions that use SPI with a dedicated resource owner, or whether >> that coverage belongs elsewhere. > > I reviewed the patch, and overall it looks close. I have a few comments: > > Should spi_exec_sql() be made exception-safe? > > The current implementation does not restore CurrentResourceOwner or relea= se/delete childowner on all error paths, and it also does not check for SPI= _connect() failure. Since this module is specifically meant to exercise Res= ourceOwner lifetime interactions, I think the helper itself should be robus= t in both success and error paths. > > Consider adding a follow-up test that does failure first, then success. > > That would help show that the helper does not leave any lingering state b= ehind after an error. > > Consider trimming the long explanatory comments in the regression test a = bit. > > The rationale is useful, but some of it is repeated across the commit mes= sage, the SQL file header, and the expected output. Thanks Haibo for the review. Your points are well taken and would need to be addressed if this module were to be committed, but I've been reconsidering whether to commit it at all. It was written to reproduce a specific crash caused by an extension's idiosyncratic use of SPI with a dedicated resource owner, a pattern that's specific to PostGIS and similar extensions rather than something core PostgreSQL exercises. Now that the crash is fixed, the module's main value is as a regression test for that one scenario. I'm not convinced it pulls its weight as a permanent addition to the test suite, especially given the maintenance burden and the time it adds to test runs. I'll hold off on committing it unless someone feels strongly that it should be included. --=20 Thanks, Amit Langote