aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/command.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-07-14 22:18:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-07-14 22:18:02 +0000
commit6bfe64032efd043f80a495a495331dcfc2d9f05c (patch)
treed0cc092d38bdea690a79e4aebfa4629e1db54e96 /src/backend/commands/command.c
parenta30bc7c75a54910a78d1939bd32f5d91164ba8a4 (diff)
downloadpostgresql-6bfe64032efd043f80a495a495331dcfc2d9f05c.tar.gz
postgresql-6bfe64032efd043f80a495a495331dcfc2d9f05c.zip
Cleanup of code for creating index entries. Functional indexes with
pass-by-ref data types --- eg, an index on lower(textfield) --- no longer leak memory during index creation or update. Clean up a lot of redundant code ... did you know that copy, vacuum, truncate, reindex, extend index, and bootstrap each basically duplicated the main executor's logic for extracting information about an index and preparing index entries? Functional indexes should be a little faster now too, due to removal of repeated function lookups. CREATE INDEX 'opt_type' clause is deimplemented by these changes, but I haven't removed it from the parser yet (need to merge with Thomas' latest change set first).
Diffstat (limited to 'src/backend/commands/command.c')
-rw-r--r--src/backend/commands/command.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 6648e66f4e3..be24c696a7c 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.88 2000/07/05 23:11:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.89 2000/07/14 22:17:42 tgl Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
@@ -1205,7 +1205,7 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
char toast_relname[NAMEDATALEN + 1];
char toast_idxname[NAMEDATALEN + 1];
Relation toast_rel;
- AttrNumber attNums[1];
+ IndexInfo *indexInfo;
Oid classObjectId[1];
/*
@@ -1334,11 +1334,20 @@ AlterTableCreateToastTable(const char *relationName, bool silent)
CommandCounterIncrement();
/* create index on chunk_id */
- attNums[0] = 1;
+
+ indexInfo = makeNode(IndexInfo);
+ indexInfo->ii_NumIndexAttrs = 1;
+ indexInfo->ii_NumKeyAttrs = 1;
+ indexInfo->ii_KeyAttrNumbers[0] = 1;
+ indexInfo->ii_Predicate = NULL;
+ indexInfo->ii_FuncOid = InvalidOid;
+ indexInfo->ii_Unique = false;
+
classObjectId[0] = OID_OPS_OID;
- index_create(toast_relname, toast_idxname, NULL, NULL, BTREE_AM_OID,
- 1, attNums, classObjectId,
- (Node *) NULL, false, false, false, true);
+
+ index_create(toast_relname, toast_idxname, indexInfo,
+ BTREE_AM_OID, classObjectId,
+ false, false, true);
/* make the index visible in this transaction */
CommandCounterIncrement();