*** pgsql/src/backend/commands/cluster.c 2009/01/16 13:27:23 1.181 --- pgsql/src/backend/commands/cluster.c 2009/02/02 19:31:38 1.182 *************** *** 11,17 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.180 2009/01/01 17:23:37 momjian Exp $ * *------------------------------------------------------------------------- */ --- 11,17 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.181 2009/01/16 13:27:23 heikki Exp $ * *------------------------------------------------------------------------- */ *************** make_new_heap(Oid OIDOldHeap, const char *** 668,673 **** --- 668,674 ---- TupleDesc OldHeapDesc, tupdesc; Oid OIDNewHeap; + Oid toastid; Relation OldHeap; HeapTuple tuple; Datum reloptions; *************** make_new_heap(Oid OIDOldHeap, const char *** 726,732 **** * AlterTableCreateToastTable ends with CommandCounterIncrement(), so that * the TOAST table will be visible for insertion. */ ! AlterTableCreateToastTable(OIDNewHeap); heap_close(OldHeap, NoLock); --- 727,750 ---- * AlterTableCreateToastTable ends with CommandCounterIncrement(), so that * the TOAST table will be visible for insertion. */ ! toastid = OldHeap->rd_rel->reltoastrelid; ! reloptions = (Datum) 0; ! if (OidIsValid(toastid)) ! { ! tuple = SearchSysCache(RELOID, ! ObjectIdGetDatum(toastid), ! 0, 0, 0); ! if (!HeapTupleIsValid(tuple)) ! elog(ERROR, "cache lookup failed for relation %u", toastid); ! reloptions = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, ! &isNull); ! if (isNull) ! reloptions = (Datum) 0; ! } ! AlterTableCreateToastTable(OIDNewHeap, reloptions); ! ! if (OidIsValid(toastid)) ! ReleaseSysCache(tuple); heap_close(OldHeap, NoLock);