diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/analyze.c | 15 | ||||
-rw-r--r-- | src/backend/commands/copy.c | 11 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 29 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 11 |
4 files changed, 23 insertions, 43 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index ff20cf96967..b757512b463 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.82 2005/02/11 00:41:12 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.83 2005/03/16 21:38:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -448,14 +448,11 @@ compute_index_stats(Relation onerel, double totalrows, { MemoryContext ind_context, old_context; - TupleDesc heapDescriptor; Datum attdata[INDEX_MAX_KEYS]; char nulls[INDEX_MAX_KEYS]; int ind, i; - heapDescriptor = RelationGetDescr(onerel); - ind_context = AllocSetContextCreate(anl_context, "Analyze Index", ALLOCSET_DEFAULT_MINSIZE, @@ -468,7 +465,6 @@ compute_index_stats(Relation onerel, double totalrows, AnlIndexData *thisdata = &indexdata[ind]; IndexInfo *indexInfo = thisdata->indexInfo; int attr_cnt = thisdata->attr_cnt; - TupleTable tupleTable; TupleTableSlot *slot; EState *estate; ExprContext *econtext; @@ -492,9 +488,7 @@ compute_index_stats(Relation onerel, double totalrows, estate = CreateExecutorState(); econtext = GetPerTupleExprContext(estate); /* Need a slot to hold the current heap tuple, too */ - tupleTable = ExecCreateTupleTable(1); - slot = ExecAllocTableSlot(tupleTable); - ExecSetSlotDescriptor(slot, heapDescriptor, false); + slot = MakeSingleTupleTableSlot(RelationGetDescr(onerel)); /* Arrange for econtext's scan tuple to be the tuple under test */ econtext->ecxt_scantuple = slot; @@ -532,8 +526,7 @@ compute_index_stats(Relation onerel, double totalrows, * convenient. */ FormIndexDatum(indexInfo, - heapTuple, - heapDescriptor, + slot, estate, attdata, nulls); @@ -585,7 +578,7 @@ compute_index_stats(Relation onerel, double totalrows, /* And clean up */ MemoryContextSwitchTo(ind_context); - ExecDropTupleTable(tupleTable, true); + ExecDropSingleTupleTableSlot(slot); FreeExecutorState(estate); MemoryContextResetAndDeleteChildren(ind_context); } diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index ed815098aba..d193d1dd311 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.237 2005/03/12 05:41:34 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.238 2005/03/16 21:38:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1487,7 +1487,6 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids, bool isnull; ResultRelInfo *resultRelInfo; EState *estate = CreateExecutorState(); /* for ExecConstraints() */ - TupleTable tupleTable; TupleTableSlot *slot; bool file_has_oids; int *defmap; @@ -1518,10 +1517,8 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids, estate->es_num_result_relations = 1; estate->es_result_relation_info = resultRelInfo; - /* Set up a dummy tuple table too */ - tupleTable = ExecCreateTupleTable(1); - slot = ExecAllocTableSlot(tupleTable); - ExecSetSlotDescriptor(slot, tupDesc, false); + /* Set up a tuple slot too */ + slot = MakeSingleTupleTableSlot(tupDesc); econtext = GetPerTupleExprContext(estate); @@ -1989,7 +1986,7 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids, pfree(constraintexprs); pfree(force_notnull); - ExecDropTupleTable(tupleTable, true); + ExecDropSingleTupleTableSlot(slot); ExecCloseIndices(resultRelInfo); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index fddfd13c716..819ac84e1e8 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.146 2005/02/09 23:17:26 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.147 2005/03/16 21:38:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2455,7 +2455,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) { ExprContext *econtext; Datum *values; - char *nulls; + bool *isnull; TupleTableSlot *oldslot; TupleTableSlot *newslot; HeapScanDesc scan; @@ -2471,17 +2471,15 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) * the tuples are the same, the tupDescs might not be (consider * ADD COLUMN without a default). */ - oldslot = MakeTupleTableSlot(); - ExecSetSlotDescriptor(oldslot, oldTupDesc, false); - newslot = MakeTupleTableSlot(); - ExecSetSlotDescriptor(newslot, newTupDesc, false); + oldslot = MakeSingleTupleTableSlot(oldTupDesc); + newslot = MakeSingleTupleTableSlot(newTupDesc); - /* Preallocate values/nulls arrays */ + /* Preallocate values/isnull arrays */ i = Max(newTupDesc->natts, oldTupDesc->natts); values = (Datum *) palloc(i * sizeof(Datum)); - nulls = (char *) palloc(i * sizeof(char)); + isnull = (bool *) palloc(i * sizeof(bool)); memset(values, 0, i * sizeof(Datum)); - memset(nulls, 'n', i * sizeof(char)); + memset(isnull, true, i * sizeof(bool)); /* * Any attributes that are dropped according to the new tuple @@ -2512,11 +2510,11 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) if (newrel) { /* Extract data from old tuple */ - heap_deformtuple(tuple, oldTupDesc, values, nulls); + heap_deform_tuple(tuple, oldTupDesc, values, isnull); /* Set dropped attributes to null in new tuple */ foreach (lc, dropped_attrs) - nulls[lfirst_int(lc)] = 'n'; + isnull[lfirst_int(lc)] = true; /* * Process supplied expressions to replace selected @@ -2528,16 +2526,11 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) foreach(l, tab->newvals) { NewColumnValue *ex = lfirst(l); - bool isNull; values[ex->attnum - 1] = ExecEvalExpr(ex->exprstate, econtext, - &isNull, + &isnull[ex->attnum - 1], NULL); - if (isNull) - nulls[ex->attnum - 1] = 'n'; - else - nulls[ex->attnum - 1] = ' '; } /* @@ -2545,7 +2538,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) * pfree it, since the per-tuple memory context will * be reset shortly. */ - tuple = heap_formtuple(newTupDesc, values, nulls); + tuple = heap_form_tuple(newTupDesc, values, isnull); } /* Now check any constraints on the possibly-changed tuple */ diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 64a7f92560c..a0ee3e8f355 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.303 2005/03/04 20:21:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.304 2005/03/16 21:38:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -114,7 +114,6 @@ typedef struct ExecContextData { ResultRelInfo *resultRelInfo; EState *estate; - TupleTable tupleTable; TupleTableSlot *slot; } ExecContextData; typedef ExecContextData *ExecContext; @@ -141,16 +140,14 @@ ExecContext_Init(ExecContext ec, Relation rel) ec->estate->es_num_result_relations = 1; ec->estate->es_result_relation_info = ec->resultRelInfo; - /* Set up a dummy tuple table too */ - ec->tupleTable = ExecCreateTupleTable(1); - ec->slot = ExecAllocTableSlot(ec->tupleTable); - ExecSetSlotDescriptor(ec->slot, tupdesc, false); + /* Set up a tuple slot too */ + ec->slot = MakeSingleTupleTableSlot(tupdesc); } static void ExecContext_Finish(ExecContext ec) { - ExecDropTupleTable(ec->tupleTable, true); + ExecDropSingleTupleTableSlot(ec->slot); ExecCloseIndices(ec->resultRelInfo); FreeExecutorState(ec->estate); } |