diff options
Diffstat (limited to 'src/backend/commands')
-rw-r--r-- | src/backend/commands/command.c | 20 | ||||
-rw-r--r-- | src/backend/commands/copy.c | 27 | ||||
-rw-r--r-- | src/backend/commands/explain.c | 16 |
3 files changed, 18 insertions, 45 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index 54b913dcac..073360c1e4 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.109 2000/11/08 22:09:57 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.110 2000/11/12 00:36:56 tgl Exp $ * * NOTES * The PerformAddAttribute() code, like most of the relation @@ -1098,13 +1098,12 @@ AlterTableAddConstraint(char *relationName, case CONSTR_CHECK: { ParseState *pstate; - bool successful = TRUE; + bool successful = true; HeapScanDesc scan; ExprContext *econtext; TupleTableSlot *slot = makeNode(TupleTableSlot); HeapTuple tuple; RangeTblEntry *rte; - List *rtlist; List *qual; List *constlist; Relation rel; @@ -1112,9 +1111,9 @@ AlterTableAddConstraint(char *relationName, char *name; if (constr->name) - name=constr->name; + name = constr->name; else - name="<unnamed>"; + name = "<unnamed>"; constlist = makeList1(constr); @@ -1169,13 +1168,6 @@ AlterTableAddConstraint(char *relationName, qual = makeList1(expr); - rte = makeNode(RangeTblEntry); - rte->relname = relationName; - rte->relid = RelationGetRelid(rel); - rte->eref = makeNode(Attr); - rte->eref->relname = relationName; - rtlist = makeList1(rte); - /* * Scan through the rows now, making the necessary things * for ExecQual, and then call it to evaluate the @@ -1188,10 +1180,8 @@ AlterTableAddConstraint(char *relationName, slot->ttc_descIsNew = true; slot->ttc_tupleDescriptor = rel->rd_att; slot->ttc_buffer = InvalidBuffer; - slot->ttc_whichplan = -1; econtext = MakeExprContext(slot, CurrentMemoryContext); - econtext->ecxt_range_table = rtlist; /* range table */ if (!ExecQual(qual, econtext, true)) { successful=false; @@ -1201,8 +1191,6 @@ AlterTableAddConstraint(char *relationName, } pfree(slot); - pfree(rtlist); - pfree(rte); heap_endscan(scan); heap_close(rel, NoLock); diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index ea90e0f2e0..2877999500 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.122 2000/09/06 14:15:16 petere Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.123 2000/11/12 00:36:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -597,7 +597,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, int32 ntuples, tuples_read = 0; bool reading_to_eof = true; - RelationInfo *relationInfo; + ResultRelInfo *resultRelInfo; EState *estate = CreateExecutorState(); /* for ExecConstraints() */ TupleTable tupleTable; TupleTableSlot *slot; @@ -609,20 +609,19 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, attr_count = tupDesc->natts; /* - * We need a RelationInfo so we can use the regular executor's + * We need a ResultRelInfo so we can use the regular executor's * index-entry-making machinery. (There used to be a huge amount * of code here that basically duplicated execUtils.c ...) */ - relationInfo = makeNode(RelationInfo); - relationInfo->ri_RangeTableIndex = 1; /* dummy */ - relationInfo->ri_RelationDesc = rel; - relationInfo->ri_NumIndices = 0; - relationInfo->ri_IndexRelationDescs = NULL; - relationInfo->ri_IndexRelationInfo = NULL; + resultRelInfo = makeNode(ResultRelInfo); + resultRelInfo->ri_RangeTableIndex = 1; /* dummy */ + resultRelInfo->ri_RelationDesc = rel; - ExecOpenIndices(relationInfo); + ExecOpenIndices(resultRelInfo); - estate->es_result_relation_info = relationInfo; + estate->es_result_relations = resultRelInfo; + estate->es_num_result_relations = 1; + estate->es_result_relation_info = resultRelInfo; /* Set up a dummy tuple table too */ tupleTable = ExecCreateTupleTable(1); @@ -830,7 +829,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, ExecStoreTuple(tuple, slot, InvalidBuffer, false); if (rel->rd_att->constr) - ExecConstraints("CopyFrom", rel, slot, estate); + ExecConstraints("CopyFrom", resultRelInfo, slot, estate); /* ---------------- * OK, store the tuple and create index entries for it @@ -838,7 +837,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, */ heap_insert(rel, tuple); - if (relationInfo->ri_NumIndices > 0) + if (resultRelInfo->ri_NumIndices > 0) ExecInsertIndexTuples(slot, &(tuple->t_self), estate, false); /* AFTER ROW INSERT Triggers */ @@ -886,7 +885,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, ExecDropTupleTable(tupleTable, true); - ExecCloseIndices(relationInfo); + ExecCloseIndices(resultRelInfo); } diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 6976278c1d..b76d45480f 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994-5, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.61 2000/10/26 21:34:44 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.62 2000/11/12 00:36:56 tgl Exp $ * */ @@ -327,32 +327,18 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es) if (IsA(plan, Append)) { Append *appendplan = (Append *) plan; - List *saved_rtable = es->rtable; - int whichplan = 0; List *lst; foreach(lst, appendplan->appendplans) { Plan *subnode = (Plan *) lfirst(lst); - if (appendplan->inheritrelid > 0) - { - RangeTblEntry *rtentry; - - rtentry = nth(whichplan, appendplan->inheritrtable); - Assert(rtentry != NULL); - rt_store(appendplan->inheritrelid, es->rtable, rtentry); - } - for (i = 0; i < indent; i++) appendStringInfo(str, " "); appendStringInfo(str, " -> "); explain_outNode(str, subnode, indent + 3, es); - - whichplan++; } - es->rtable = saved_rtable; } if (IsA(plan, SubqueryScan)) |