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 1wU6CI-000wek-2D for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Jun 2026 17:13:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wU6CF-00Ahfp-2y for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Jun 2026 17:13:03 +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 1wU6CF-00Ahfg-1C for pgsql-bugs@lists.postgresql.org; Mon, 01 Jun 2026 17:13:03 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wU6CC-00000000hPZ-3019 for pgsql-bugs@lists.postgresql.org; Mon, 01 Jun 2026 17:13:03 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5C95E140014F; Mon, 1 Jun 2026 13:12:58 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Mon, 01 Jun 2026 13:12:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= 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=1780333978; x= 1780420378; bh=aVrcAyEUAoONWmhUafH2e5Op+mQXwEd19o2NuB2Xmt0=; b=e 9El43qENAvSgvh9amw4PzHzZlpjEop6X01G13s+7Wgfhne5tRkytxtF09Iv74rVc 13owZu5uS/aJ/lDzxaBWw/NwdPYMm2SpxpbWhtpu14Kl7dTn5sQ01vw1dfQez5jr YeD1D6rK/MJjuSQzoQ1pu3eXRgIG+ng6ABlCkUjsZ2C0ZJa+ex4lUGovP9i5mXoh xCkdazGSoqG9fRTAUiCrOtleoA1FzG7SrGD64e7zRoVraGLjBOlCi7QotT5M+0ct rYJgj0iSGe+oIcAzBi6+2KRpOvyIX9BRFa2adbIkJkpEtwRiqMBXgN3YXIG958m6 6u6mVntrr+03I7xI+W8cA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=1780333978; x=1780420378; bh=aVrcAyEUAoONW mhUafH2e5Op+mQXwEd19o2NuB2Xmt0=; b=acdxv3s/MAEOxhfZE+P+BHzXpF27P Z9y0w8kFZk39PVAkdi6Qfva1jEtEFRiUyRgQt+RnoSLun+E7uMH9JIkYC5lPKVr1 0+vOb9gUq0/MEgrOqhUgfBKyXg2v20MR2YybtMG+BvfBjG3Xx3OeHEkrVC3T9cjq E5t9zW0/2+C3bMIwylm/PMbEaCsg//CkpJ4/N+loe+S3JxPNb8pdUwua0cnGjZde a/PYmQeTM1NqtljrLuMWph5uwwyYhtznIJbZ7demPvm4zR/Fmm4FAc+rsTC/QPzE lJc7zBRHXsF5IgxkXFtDuaMQ7NRbBmOdlzT7ayJrp9cTH7bwrip4MrGtA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEUkGENecYH82x+kKhXepzja17mikU21W8xXMgvVMhQiSxWtsiNPNvrBDWQDU3PNd NIhITmiDf4vvWqchmnqvalWdES6s9RigHtwyuPFsGK/lLBQjoHuYC8l/u4iVI7fZdJuWTD fZJqKRT563JBnmf8jn1UmCZF2tDFhjRwtsK1CdXFd4tNMjmYTfRuzbv7+Ul85nQyT8Qn/X oAgyvdPLub7eBrNK+x7lBJdBpnpixH9NUkiQSWxIe8MxycPn4JxlvB0VBn31SH/kQZyHLX jgJTy3whlW2pkoLIDb9RVcL3JaL0+xRAwWyPO4YPlMOzlDAIk88j8vdpHw2sDTIjvnmJkW QjlkFqxmqWiE8eyXuIFrirC1lUQ4OjgCieWIgRyakIW0wrhEVXm994oY3K/JtbvbX/CN89 hPcyqOSgy014EOGj3EcEnkY5JrI4004QZWfYM0hBsIYckH404UU/pqvw8czOT5+j0V6JHB fHzBrWq2vTgM2BMppAnE27WxaTsWsFsVHp81yEwXHkce1fGSaREomtJDhL7IPx1FYBtOz2 Q9cILGioYsyXrk5OKw2X+6fOLgcgHOso3ZA2oYyDu0DDl6azDcIZbctKw6bdTb+C4cvYUF bpeAVLZwYD/xw2k3AGGmd6omztX4/BC1tgdfaBnFR0RASQTyqJigmu0ifiKQ X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Jun 2026 13:12:56 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1780333973; bh=OjQdovlLgLkU2ZwnOrmErpXyEJaKsUvm8hDQLbZ7Anc=; h=Date:From:To:Subject:In-Reply-To:From; b=PvBPRTXEwFvm/0Zwq2lgDBeABFM68iGHGdsZDii56GfBGr5BQwNR2UC/wDQagx8mU 63BNbg/97A41fxHo8U7K3tfPSp5l84VvGI5iG+5VVMEU1MHpz5vGTbrkMVPxfY21Bx S8KL6qw83RxI8dRc2mwfiJ9DxKYLxpJ5FgAH6HGa389SoCHW2QDyNy6Gc1O1eA6uE1 CPGVrTbNQatSM1xDsfgTKT2UvSlqh4b8pEYgltaW2s71Y7WZtkDd1hglp3ZHNiNibx GZWom7VxIMUIkJJGzfFM4dZt+FH2TU356VFAJVX3ALCWPOCoIDqK8N3pjvktp9lK0N aiTvBQSNp7UhQ== Received: by ida.kurilemu.internal (Postfix, from userid 1000) id 6788AB0064E; Mon, 01 Jun 2026 19:12:53 +0200 (CEST) Date: Mon, 1 Jun 2026 19:12:53 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: n.kalinin@postgrespro.ru, pgsql-bugs@lists.postgresql.org, Antonin Houska , b@ida.kurilemu.internal Subject: Re: BUG #19500: pgrepack logical decoding plugin can crash assert builds via SQL decoding API Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="g2p5afb23t36fp4l" 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 --g2p5afb23t36fp4l Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2026-May-29, Álvaro Herrera wrote: > On 2026-05-28, PG Bug reporting form wrote: > > > It appears that the pgrepack output plugin is accessible through the > > SQL logical decoding API, even though the plugin code explicitly > > indicates that this interface is not supported. Reading changes from > > such a slot can cause a backend process crash in builds with asserts > > enabled. > > Yeah, I would like to have a way to prevent this, if only for > user-friendliness, but it's not terribly pressing since only a role > with REPLICATION privs can create the replication slot, which as I > recall are already pretty powerful. How about something like this? It makes your test case throw an error instead of failing the assertion, which I suppose is an improvement. The patch is a bit noisy because I moved more code than the minimum necessary; but the gist of it is that we allocate RepackDecodingState in repack_startup(), then have repack_setup_logical_decoding() fill in a magic number, which we later check in repack_begin_txn(). This is a bit wasteful, because we have to do that check once for each and every transaction; however I see no other callback that would let us do this kind of check after the slot is created but before we start to consume from it. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Before you were born your parents weren't as boring as they are now. They got that way paying your bills, cleaning up your room and listening to you tell them how idealistic you are." -- Charles J. Sykes' advice to teenagers --g2p5afb23t36fp4l Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Have-RepackDecodingState-carry-a-magic-number.patch"