diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-30 19:45:17 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-30 19:45:17 +0000 |
commit | 896bd121cc4d468245acb76232b95100d5a87e12 (patch) | |
tree | 3df423cfa4c01422d510ae30531ca4c479bcbf52 /src/backend/commands/cluster.c | |
parent | a03c0d93d5a2730f25a3b2738300dacd8ca5e24a (diff) | |
download | postgresql-896bd121cc4d468245acb76232b95100d5a87e12.tar.gz postgresql-896bd121cc4d468245acb76232b95100d5a87e12.zip |
Code review for transaction-safe-TRUNCATE patch: minor cleanups.
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 0361ede0092..4858504f58d 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.103 2002/12/30 18:42:13 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.104 2002/12/30 19:45:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -26,7 +26,6 @@ #include "catalog/index.h" #include "catalog/indexing.h" #include "catalog/namespace.h" -#include "catalog/pg_constraint.h" #include "commands/cluster.h" #include "commands/tablecmds.h" #include "miscadmin.h" @@ -111,9 +110,9 @@ cluster(ClusterStmt *stmt) RelToCluster rvtc; /* Find and lock the table */ - tableOid = RangeVarGetRelid(stmt->relation, false); + rel = heap_openrv(stmt->relation, AccessExclusiveLock); - rel = heap_open(tableOid, AccessExclusiveLock); + tableOid = RelationGetRelid(rel); /* Check permissions */ if (!check_cluster_permitted(tableOid)) @@ -325,6 +324,13 @@ cluster_rel(RelToCluster *rvtc, bool recheck) elog(ERROR, "CLUSTER: cannot cluster system relation \"%s\"", RelationGetRelationName(OldHeap)); + /* + * Don't allow cluster on temp tables of other backends ... their + * local buffer manager is not going to cope. + */ + if (isOtherTempNamespace(RelationGetNamespace(OldHeap))) + elog(ERROR, "CLUSTER cannot be used on temp tables of other processes"); + /* Drop relcache refcnt on OldIndex, but keep lock */ index_close(OldIndex); |