Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id E3EE1133798E for ; Wed, 20 Apr 2011 18:47:49 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 28332-03 for ; Wed, 20 Apr 2011 21:47:32 +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 9F7C7133616B for ; Wed, 20 Apr 2011 18:47:31 -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 p3KLlU7W019838; Wed, 20 Apr 2011 17:47:30 -0400 (EDT) To: "Daniel Grace" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5985: CLUSTER ... USING can fail with ERROR: index xxx does not belong to table yyy In-reply-to: <24596.1303193552@sss.pgh.pa.us> References: <201104182131.p3ILVed6061175@wwwmaster.postgresql.org> <24596.1303193552@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 19 Apr 2011 02:12:32 -0400" Date: Wed, 20 Apr 2011 17:47:30 -0400 Message-ID: <19837.1303336050@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/165 X-Sequence-Number: 30084 I wrote: > "Daniel Grace" writes: >> One such file (contents listed below, admittably not 100% useful without a >> full schema and data) makes a bunch of alterations to a table but fails when >> it reaches CLUSTER: >> psql:D:/SVN/wings/wings/branches/devpg/db/lib/course.sql:38: ERROR: index >> 178138 does not belong to table 176177 >> However, this failure only occurs if the file is wrapped in a transaction >> block. Outside of a transaction block, it works fine. > I wonder if the issue is that the planner thinks the index isn't usable > yet because of HOT-chain issues. On closer inspection this seems to be just insufficient consideration of corner cases. We can handle it with a pretty trivial fix in plan_cluster_use_sort. Thanks for the bug report! regards, tom lane