*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.131.4.1 2005/02/06 20:19:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.131.4.2 2007/09/12 15:16:23 alvherre Exp $
*
*-------------------------------------------------------------------------
*/
*/
OldHeap = heap_open(rvtc->tableOid, AccessExclusiveLock);
+ /*
+ * Don't allow cluster on temp tables of other backends ... their
+ * local buffer manager is not going to cope. In the recheck case,
+ * silently skip it. Otherwise continue -- there is a hard error
+ * in check_index_is_clusterable.
+ */
+ if (recheck && isOtherTempNamespace(RelationGetNamespace(OldHeap)))
+ {
+ heap_close(OldHeap, AccessExclusiveLock);
+ return;
+ }
+
/* Check index is valid to cluster on */
check_index_is_clusterable(OldHeap, rvtc->indexOid);