diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2007-09-12 15:16:23 +0000 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2007-09-12 15:16:23 +0000 |
commit | bf476b94b1741e5f3e1867bb3896f8a4c3bcb45e (patch) | |
tree | 097d3a2e57b02f98a3c615c78b08951fb2db732a /src | |
parent | d48f8ab8e19fe390d0be69418772ba1eae9ae8cf (diff) | |
download | postgresql-bf476b94b1741e5f3e1867bb3896f8a4c3bcb45e.tar.gz postgresql-bf476b94b1741e5f3e1867bb3896f8a4c3bcb45e.zip |
Fix the database-wide version of CLUSTER to silently skip temp tables of
remote sessions, instead of erroring out in the middle of the operation.
This is a backpatch of a previous fix applied to CLUSTER to HEAD and 8.2, all
the way back that it is relevant to.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/cluster.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 7e1c2e3b08d..5cc6aca59d3 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * 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 $ * *------------------------------------------------------------------------- */ @@ -291,6 +291,18 @@ cluster_rel(RelToCluster *rvtc, bool recheck) */ 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); |