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 1x3t34-006jmN-2u for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2026 10:27:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x3t32-006NBf-28 for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Sep 2026 10:27:28 +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 1x3t32-006NBX-0C for pgsql-hackers@lists.postgresql.org; Tue, 08 Sep 2026 10:27:28 +0000 Received: from flow-a6-smtp.messagingengine.com ([103.168.172.141]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x3t2y-00000004a0y-0DAH for pgsql-hackers@postgresql.org; Tue, 08 Sep 2026 10:27:25 +0000 Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailflow.phl.internal (Postfix) with ESMTP id 8C429138003B; Tue, 8 Sep 2026 06:27:22 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Tue, 08 Sep 2026 06:27:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1788863242; x= 1788870442; bh=82OEEED/oBZ4bWgw9yiDtv9RvfQEFfNF5UvHVeit3JM=; b=E qDNn+ItlHmfj85/rlpCKTnHyVZLVzE+AkNnLuHT1eqI1wmmnNJ/K2kWh3RHsM3LW h38AlRTvGPOKrP6fOJhh1kUs1rgfnMoOFlMEa9M611qZujT5jRtc7eOk9gQEYmtz jQ+fanUWYuszaCYJ104+XDsw6j7m158E2dHAB0vYjy8HnbVsNP7+5gInxWid8XvV hyJfxSgZGWZp/Q0DYJ0le+0HUsCbxvpmgPzkdcrDRFJKDJ/36FfW1bblhI79hsYl gCgeTGT+TZLS+1tMTFkXOs1GpjLGyGQ4wjDbYf5Ke5oX4hVMxo3ZwtdTudlR+49z 3bEYuDJ08zUkS1su80jCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1788863242; x=1788870442; bh=8 2OEEED/oBZ4bWgw9yiDtv9RvfQEFfNF5UvHVeit3JM=; b=YqvtTAjoMe93hXZnx H5BSkAMLsoASvbmeIvmXsqJmQNNRvGRjC6AgUiD/jrqBS5mbQhuAGYm9igIhwIVC TnleHDyxhi4flyDndrAXBe9KoZVw//IUSu1wBByGWhfzqPGH+EKwsmPbwKDnQtdZ 5t7zwUw48wgXJfa1wlh2mRKFXXmvIOEwDjZLfB+6rdzq3JBfMtMPGPBeoj1L/2/t blT9VZay3w2XA6MUyku4++nqZVzKSYdGw+OOb+zHTK6pSyyjpGCOTNajBimdBI1h /MazxletpZdpDFyju01pGTwt2V+u0dnVR9xHVKwKOJaQS2cu4M+oVx0QCYvfBqgL ldh/w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEmsGEwAk6SPaJCzziZtWJK37UyxnbORuipV804q5HknaEXkfq1dZUdu5qQ3FFIfb W4tuldmO0skmWJdKsTAklL+skzoK9XmIFpCsfnRHbxVKpiXON5+A6CrngSs76CT2j7ZTDq +qkmHYP+3R/DQDbouN2p76LJPuqRX/ZyMZ5WlSVjR5fJCYspODICWjXrUZVur4/QBOY4ZM 9wrIynV3zAhdGM6+ZsiXvmfTpC4oV5NsDoAG1VvbdoNVXMAKQBhIrBn79vToFl9jsjic1e CZmy++FGvSW2h+JxrLcnI3A7fuT06JOwpKVYuLr8G8R20fCEUOicx11l6psLznBDE8sHL5 O7Daw3LWXyiA2287KKBcG9Y7cjmgSYm8KgYGqhAQarGuRsd7qAsajXXksRDH8ZJFY6thX/ CpONgnrC0LWarqIsnETGjkco8V6zLYVl6xK3Loc8ZB0jPsaXI4HZZLBO8pgDiOcwsOKDTv v+U+xCSVXC9YMhEHyZTLtUg8qg4bZD6RoAI2ha5YC+RXBoiKgv3/od+wcFd2LczTzBttmu 4fxQixo0Z30ch8s4t053lO+bwSjJZAeomKAE11CAm4zEX9xbhYfTH6VWgVLru2mSsiDihg RIk3cL7YXd5+ro/4/JH5+7RGD5zPdcqVXDKpTQ39lQ2jhwgmgifvv6GzLeHg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Sep 2026 06:27:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1788863239; bh=zaTEEIIAhfCb4pAJFU5dLDh/gx+/u2Zo/P0o/WabxhY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=dtciEPug2zcgUECwoQZqz3q20SRi9AsNttk8i7wlrB1tIpQXW/EPsz5S6Hf4gqW7V tKVvRpSgZoTXGWgCrlvQs2eMms8smXf12XMgxlFrUjzQ5KpOnFYL9pXkVT1/4e62Ks gDbosD0Cp/3cphrHsjdwt0fXJHf4hJ4eYpIO/Ru9vxqDmltJNAG2BJ0LGYQuUgLi9a WlulyhlP5FY1eSMc6mTpJQ4Gr3AMdpK1odu3hfxZiRrk1Zo17agoPOVXjQHtUbMcOq m3ScJgUTIxQeG7UpT04jsr7xlEH/vxKKU0gw6tJfVrqKeXFKy0F84XwYsi4bAqluIg eREXhvl6BYtFg== Received: by ida.kurilemu.internal (Postfix, from userid 1000) id B4A00B009D1; Tue, 08 Sep 2026 12:27:19 +0200 (CEST) Date: Tue, 8 Sep 2026 12:27:19 +0200 From: Alvaro Herrera To: Osama Abdul Qader Cc: Antonin Houska , Fujii Masao , Nathan Bossart , pgsql-hackers@postgresql.org Subject: Re: REPACK (ANALYZE) within transaction block segfaults Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Sep-05, Osama Abdul Qader wrote: > I understand the distinction now. Allowing REPACK (ANALYZE) in a > transaction block in the future would not necessarily mean that it is safe > to execute it from a function, procedure, or DO block, since ANALYZE may > start a new transaction in process_single_relation() while an SPI session > is active. Well, I think the main point of running REPACK (ANALYZE) inside a transaction is to allow it to run in a procedure. Consider something like do $$ declare r record; begin for r in select relname from pg_class where relkind = 'r' and relnamespace = (select oid from pg_namespace where nspname = 'public') loop execute 'repack (verbose) ' || r.relname; commit; end loop; end $$; This works fine today and with the patch, both with REPACK and with CLUSTER (good); but not with VACUUM FULL (sad, but we no longer care: just use repack.) This is useful because it allows server-controlled execution of repacking each table in its own transaction. But as soon as you add the ANALYZE option, which would be valuable, this recipe no longer works. My point is that just the ability to run REPACK (ANALYZE) in a transaction block without allowing it in a function would be, I think, rather pointless -- who could possibly be interested in repacking multiple tables in the same transaction? There's just no benefit. OTOH I think it may even be useful to implement in-procedure execution for CONCURRENTLY, but that's likely a more challenging patch than ANALYZE. Anyway, anything beyond the patch as currently presented would be for pg20 or beyond. I'm running the current patch through CI and will push as soon as I get a green. Thanks! -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "La libertad es como el dinero; el que no la sabe emplear la pierde" (Alvarez)