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.98.2) (envelope-from ) id 1xA7MO-00000002Sh7-0FgL for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 14:57:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xA7MN-00000001IUC-1Yqq for pgsql-hackers@arkaria.postgresql.org; Fri, 25 Sep 2026 14:57:11 +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.98.2) (envelope-from ) id 1xA7MM-00000001IU1-016i for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 14:57:11 +0000 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xA7MH-00000001DIk-2oc5 for pgsql-hackers@lists.postgresql.org; Fri, 25 Sep 2026 14:57:09 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 8E959EC0190; Fri, 25 Sep 2026 10:57:04 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 25 Sep 2026 10:57:04 -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=fm3; t=1790348224; x= 1790434624; bh=J4/EWM4MHZl9B4BdaOS3bbwuywSz2rdr4FGahj98qQ0=; b=v g+pJ7Tiw2M2GRph3vnZIYbyOVY/hTQe3XYEJNI0pIPUxCgqqt0H5Csy4xCCU5Ca8 UqWaCFRsnxHulACx8ACARQRk+Xt8eex8mcUJso52GN8Xdc5MokidZuRIboA0fmuK rlYdKzNjYZ0YhGsvXUXSOxS/6mm0EgL6Tm8zyt0KHILM6mB3fBiVzY1ORnhV21g9 R2zVDotN4Uy9GRkidwoCDIr5dg3zQ2dQq4VIBWHoTOfoEe3tvRroeXC7dYJPaAHd qf1KIJ6+HYM1nYzztP1dLu+RzsCXI0dwxSVMaUf0isHoA2ijCQKC/opMbsAE+WMA xqSTY9X1oEIV0+Cr9Nw8A== 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=1790348224; x=1790434624; bh=J 4/EWM4MHZl9B4BdaOS3bbwuywSz2rdr4FGahj98qQ0=; b=tU5ug30PArRoOJzWk lHh/uZOgGDIfY/V/KKVhnfVL+0e9MKUfuu1A4AA5vyqsVnU3rdI0QnqUDq98lcx2 9Ggzzlih/sv/WtZHd1HNJalJRBW7VoGKNhuH2POBSpCc6AeFMGkhN6EPaCIKThzh uN4Xr5/qQFEzmKdV35NBptzv714C119qRcET2o4vBCWmeqRp9Z9N6ibXU5eUXjGQ ikco+jj7Ep8X3LWXfoJHYBRzOOntfZSHXoAv0Kxib6FG3F8sC6oxcobSfsDpQVRY I1oFcgD0kUFBoo8dM2MOF7K5xXoBizvsMhZVFoWRjxFtCmRDhZPCoQSnfUDUOJ8Y eb2KQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGjRfp+RyQ3YHP8NDIB/Ir2PmVU9jEJ2UIlSPoQ7MbOqfr7xOo2BqgM7M4EdyDj8u wp6LfHQ40pcXR7k41FqAQ8evstgKiushTK9a7QuhXlLrZcuHY9UZJStOLr34lI4t17OjJN AcRGy2vMPsZNrhW1+fjgJVIRZ/jFKSEn9klRUhz7OCED1XbH+2b5afhsZSW9LxGeF1GlGJ MCQ9jKo4iWN74ed0YNebIitQ4TG74VwuiuQ1XucsRvGmx39JNonhft3acuyeOC1gwOQTfF UwjR76zq3NwYhqt2uGXTcC8dgv87EgCch7m+o4VJJx2ckYS35ppGNMMj6fWnI3M794iAm6 sirwUJ0pogk7cP20OmmdwB9hnccWLfT3Sz3tXF1rmtWYJPy1arZOmH7CS3K884VB+z810k 8uLixaFfFNlMOdEIct7yPqWJk1uzBqeX/qbuxXW/fUiKFXmM+3THdL+eRsc1wK3P1lfx+X UzNLtL6EBKneBvlDHBqznMMm5LDlPxMYXw1GbE81iPiJ9y05mdJeKj0leMQYbA1HBYbmcr CLLX5c8OWkMzNU3fbSGJ5tEJsYaUwDLxZrbArvwHO/gAtPEyk+XS8cmRXAFmNFqE7H7x86 x+sQU4huL12nNDD2E7Ewao79DQzDeBXgxcAV46EzMfUjL53nn/QsxU3xtdbA X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 25 Sep 2026 10:57:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1790348218; bh=GlaMDKtXExwFZX5DfPio6Jh2Mn/Jkv3iDjCa//j37Xc=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Ns4w9Qvs+rc69x/Ss9PHLkP9io7sgQ0X5H7xtl6I7mzWE73a9ZqgDaNkrJdqWbEHE lm/Ij4rWcwLd7Vte304y8Xnz09enJzSMoq7yp5G9saESBrZ8sUSlr56qCAKZNjXfGY +azvMpqkwfGEp6HrnpJ1QGwltKbLe3trf3Iq1LSufhpsL9s478onrU2MDocoMp4wgq oHLX44eg+5YTPsf/0oHJH2gDJHbNTrbx2W36Wi+lPO1ypvsIVrHVEiz2y0xE7K560o a8p+G+MZTlV3CPuRrZV2wyoLg71bcFzoIOyKNdJQvWHP6rr1LI9VuYakAC7cm1nRLI ALUPSaTwMMs4w== Received: by ida.kurilemu.internal (Postfix, from userid 1000) id C812AB00096; Fri, 25 Sep 2026 16:56:58 +0200 (CEST) Date: Fri, 25 Sep 2026 16:56:58 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Thom Brown Cc: Antonin Houska , shihao zhong , Robert Treat , Masahiko Sawada , Manu , pgsql-hackers@lists.postgresql.org Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nyjzce72b5mmvfal" 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 --nyjzce72b5mmvfal Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2026-Sep-25, Thom Brown wrote: > Moving it into cluster_rel() makes sense, but does it need to be the > full ShareUpdateExclusiveLock there? Yeah, it's better to acquire the lock you want upfront, because otherwise you introduce more risk of deadlock caused by lock upgrades (admittedly the user would have to be doing something really stupid in order for this to be a real problem, but still.) It's only AEL that we don't want to hold for long. Maybe the patch could be somewhat like this, then? I didn't review the test carefully other than running without the code fix to verify that it fails, and then passes with the fix; and I didn't read the commit messages either, which I think are LLM-written and not really correct. (Also, I would push both things as a single commit.) I think changing the lock as obtained by copy_table_data is not very nice, because that one is unconditional, and here we only want it in concurrent mode. BTW I noticed that the comment for copy_table_data mentions decoding_ctx as an argument, which doesn't exist. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "Nunca se desea ardientemente lo que solo se desea por razón" (F. Alexandre) --nyjzce72b5mmvfal Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=v4-0001-Test-TOAST-rewrite-during-REPACK-CONCURRENTLY-sta.patch