Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 615496337FB for ; Fri, 16 Apr 2010 11:24:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 75566-03 for ; Fri, 16 Apr 2010 14:23:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 9CEBD632369 for ; Fri, 16 Apr 2010 11:23:52 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o3GENmXG008601; Fri, 16 Apr 2010 10:23:51 -0400 (EDT) To: Khangelani Gama cc: "pgsql-admin@postgresql.org" Subject: Re: How can I find a broken row in a table In-reply-to: References: Comments: In-reply-to Khangelani Gama message dated "Fri, 16 Apr 2010 10:22:27 +0200" Date: Fri, 16 Apr 2010 10:23:48 -0400 Message-ID: <8600.1271427828@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201004/212 X-Sequence-Number: 34306 Khangelani Gama writes: > Please help me, I am using PostgreSQL 7.3.4 running on Redhat5 > there is a table that has a broken row, but now I don't know which one is broken. the table has about 20974 pages. is there a command to find this? You have to use divide-and-conquer. Try select ctid from table limit N; and vary N until you find the largest value that *doesn't* produce an error. The block number in the last ctid from that query is the block before the bad one, or possibly a small number of blocks before the bad one if there are some totally-empty blocks. regards, tom lane