aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/cluster.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-07-04 06:11:54 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-07-04 06:11:54 +0000
commitcdeca5f590cc3c336c9c217831d68a2ca7f15265 (patch)
treef233f7ae62023950d1c169530b83f705c63ceed0 /src/backend/commands/cluster.c
parent9cf327790d978fc4ec6dba1c7f456e0a7596e4e2 (diff)
downloadpostgresql-cdeca5f590cc3c336c9c217831d68a2ca7f15265.tar.gz
postgresql-cdeca5f590cc3c336c9c217831d68a2ca7f15265.zip
Make toast-table creation and deletion work somewhat reliably.
Don't go through pg_exec_query_dest(), but directly to the execution routines. Also, extend parameter lists so that there's no need to change the global setting of allowSystemTableMods, a hack that was certain to cause trouble in the event of any error.
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r--src/backend/commands/cluster.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 0fff922545c..38539707cd8 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.56 2000/06/17 23:41:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.57 2000/07/04 06:11:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,6 +30,7 @@
#include "catalog/pg_proc.h"
#include "commands/cluster.h"
#include "commands/rename.h"
+#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
@@ -140,7 +141,7 @@ cluster(char *oldrelname, char *oldindexname)
StartTransactionCommand();
/* Destroy old heap (along with its index) and rename new. */
- heap_drop_with_catalog(saveoldrelname);
+ heap_drop_with_catalog(saveoldrelname, allowSystemTableMods);
CommitTransactionCommand();
StartTransactionCommand();
@@ -176,7 +177,8 @@ copy_heap(Oid OIDOldHeap)
tupdesc = CreateTupleDescCopy(OldHeapDesc);
OIDNewHeap = heap_create_with_catalog(NewName, tupdesc,
- RELKIND_RELATION, false);
+ RELKIND_RELATION, false,
+ allowSystemTableMods);
if (!OidIsValid(OIDNewHeap))
elog(ERROR, "clusterheap: cannot create temporary heap relation\n");
@@ -276,7 +278,8 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
(Node *) NULL, /* XXX where's the predicate? */
Old_pg_index_Form->indislossy,
Old_pg_index_Form->indisunique,
- Old_pg_index_Form->indisprimary);
+ Old_pg_index_Form->indisprimary,
+ allowSystemTableMods);
setRelhasindexInplace(OIDNewHeap, true, false);