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.94.2) (envelope-from ) id 1v3dQ0-0019jC-K5 for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 16:41:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v3dPx-00B85q-Op for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Sep 2025 16:41:34 +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.94.2) (envelope-from ) id 1v3dPx-00B85b-FW for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 16:41:34 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v3dPv-000vxX-1q for pgsql-hackers@lists.postgresql.org; Tue, 30 Sep 2025 16:41:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 58UGfTuv499687; Tue, 30 Sep 2025 12:41:29 -0400 From: Tom Lane To: Aleksander Alekseev cc: Frits Hoogland , pgsql-hackers@lists.postgresql.org Subject: Re: The ability of postgres to determine loss of files of the main fork In-reply-to: References: <013D63E2-5D75-492E-85FF-1D5CC0148C82@gmail.com> Comments: In-reply-to Aleksander Alekseev message dated "Tue, 30 Sep 2025 18:55:16 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <499685.1759250489.1@sss.pgh.pa.us> Date: Tue, 30 Sep 2025 12:41:29 -0400 Message-ID: <499686.1759250489@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Aleksander Alekseev writes: >> Therefore, I would like to request an enhancement: add an option to >> verify_heapam() that causes the primary key index to be scanned and makes >> sure that all line pointers in the index point to existing tuples. > ... IMO there is little value in adding a check for the existence of > the segments for a single table. And the *real* check will not differ > much from something like SELECT * FROM my_table, or from making a > complete backup of the database. As Frits mentioned, neither of those actions will really notice if a table has been truncated via loss of a segment. However, I think the requested functionality already exists via contrib/amcheck (see the heapallindexed option). The user does have to make a decision which index to check with, but I think that'd be required anyway --- as you say, there isn't necessarily a primary key. regards, tom lane