Re: ALTER TABLE name RENAME TO new_name; does notworkimmediately - Mailing list pgsql-bugs

From Gregory Stark
Subject Re: ALTER TABLE name RENAME TO new_name; does notworkimmediately
Date
Msg-id 87hc9sd7hb.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: ALTER TABLE name RENAME TO new_name; does notworkimmediately  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Apparently, rd_indexattr needs to get cleared someplace where it
> isn't being cleared right now.  I'm sure this is related to the
> fancy dance we do for pg_class reindexing, but not sure yet where
> to fix it.

Yeah, doing the equivalent of this in gdb seems to fix it (haven't rebuilt yet
to test that I haven't done something silly in the C code though)


--- index.c    30 Jul 2008 21:56:59 +0100    1.300
+++ index.c    10 Aug 2008 19:55:21 +0100
@@ -2382,6 +2382,11 @@
     is_pg_class = (RelationGetRelid(rel) == RelationRelationId);
     doneIndexes = NIL;

+    /* have to build the HOT indexed column bitmap before we start lying about
+     * what indexes exist... */
+    if (is_pg_class && !rel->rd_indexattr)
+        (void)RelationGetIndexAttrBitmap(rel);
+
     /* Reindex all the indexes. */
     foreach(indexId, indexIds)
     {


--
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE name RENAME TO new_name; does notworkimmediately
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #3818: Cross compilation problems