aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/command.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-11-12 00:37:02 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-11-12 00:37:02 +0000
commit6543d81d659f4176c6530fb09eef83deede264a0 (patch)
treec1dd2a57ee5e640214978ae72e8e7b2f624f8972 /src/backend/commands/command.c
parent609f9199af2411a52bb9731d8aa1f13885c439b5 (diff)
downloadpostgresql-6543d81d659f4176c6530fb09eef83deede264a0.tar.gz
postgresql-6543d81d659f4176c6530fb09eef83deede264a0.zip
Restructure handling of inheritance queries so that they work with outer
joins, and clean things up a good deal at the same time. Append plan node no longer hacks on rangetable at runtime --- instead, all child tables are given their own RT entries during planning. Concept of multiple target tables pushed up into execMain, replacing bug-prone implementation within nodeAppend. Planner now supports generating Append plans for inheritance sets either at the top of the plan (the old way) or at the bottom. Expanding at the bottom is appropriate for tables used as sources, since they may appear inside an outer join; but we must still expand at the top when the target of an UPDATE or DELETE is an inheritance set, because we actually need a different targetlist and junkfilter for each target table in that case. Fortunately a target table can't be inside an outer join... Bizarre mutual recursion between union_planner and prepunion.c is gone --- in fact, union_planner doesn't really have much to do with union queries anymore, so I renamed it grouping_planner.
Diffstat (limited to 'src/backend/commands/command.c')
-rw-r--r--src/backend/commands/command.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 54b913dcac1..073360c1e4a 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);