1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Rename Temp to Noname for noname tables.

This commit is contained in:
Bruce Momjian
1999-02-09 17:03:14 +00:00
parent 78511d8fe9
commit 318e593f03
21 changed files with 198 additions and 198 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.26 1999/02/03 20:15:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.27 1999/02/09 17:02:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,7 +87,7 @@ cost_seqscan(int relid, int relpages, int reltuples)
/*
* cost of sequentially scanning a materialized temporary relation
*/
temp += _TEMP_SCAN_COST_;
temp += _NONAME_SCAN_COST_;
}
else
{
@@ -198,7 +198,7 @@ cost_sort(List *keys, int tuples, int width, bool noread)
numTuples * base_log((double) pages, (double) 2.0);
if (!noread)
temp = temp + cost_seqscan(_TEMP_RELATION_ID_, npages, tuples);
temp = temp + cost_seqscan(_NONAME_RELATION_ID_, npages, tuples);
Assert(temp >= 0);
return temp;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.12 1999/02/09 03:51:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.13 1999/02/09 17:02:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -325,8 +325,7 @@ new_join_pathkeys(List *outer_pathkeys,
foreach(i, outer_pathkeys)
{
outer_pathkey = lfirst(i);
x = new_join_pathkey(outer_pathkey, NIL,
join_rel_tlist, joinclauses);
x = new_join_pathkey(outer_pathkey, NIL, join_rel_tlist, joinclauses);
if (x != NIL)
t_list = lappend(t_list, x);
}
@@ -421,8 +420,9 @@ new_matching_subkeys(Var *subkey,
foreach(i, joinclauses)
{
joinclause = lfirst(i);
tlist_other_var = matching_tlvar(other_join_clause_var(subkey, joinclause),
join_rel_tlist);
tlist_other_var = matching_tlvar(
other_join_clause_var(subkey, joinclause),
join_rel_tlist);
if (tlist_other_var &&
!(member(tlist_other_var, considered_subkeys)))

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.39 1999/02/09 03:51:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.40 1999/02/09 17:02:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,8 +40,8 @@
#include "optimizer/internal.h"
#define TEMP_SORT 1
#define TEMP_MATERIAL 2
#define NONAME_SORT 1
#define NONAME_MATERIAL 2
static List *switch_outer(List *clauses);
static Scan *create_scan_node(Path *best_path, List *tlist);
@@ -60,8 +60,8 @@ static HashJoin *create_hashjoin_node(HashPath *best_path, List *tlist,
List *clauses, Plan *outer_node, List *outer_tlist,
Plan *inner_node, List *inner_tlist);
static Node *fix_indxqual_references(Node *clause, Path *index_path);
static Temp *make_temp(List *tlist, List *keys, Oid *operators,
Plan *plan_node, int temptype);
static Noname *make_noname(List *tlist, List *keys, Oid *operators,
Plan *plan_node, int nonametype);
static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid,
List *indxid, List *indxqual, List *indxqualorig, Cost cost);
static NestLoop *make_nestloop(List *qptlist, List *qpqual, Plan *lefttree,
@@ -72,7 +72,7 @@ static Hash *make_hash(List *tlist, Var *hashkey, Plan *lefttree);
static MergeJoin *make_mergejoin(List *tlist, List *qpqual,
List *mergeclauses, Oid opcode, Oid *rightorder,
Oid *leftorder, Plan *righttree, Plan *lefttree);
static Material *make_material(List *tlist, Oid tempid, Plan *lefttree,
static Material *make_material(List *tlist, Oid nonameid, Plan *lefttree,
int keycount);
/*
@@ -476,11 +476,11 @@ create_nestloop_node(JoinPath *best_path,
}
else if (IsA_Join(inner_node))
{
inner_node = (Plan *) make_temp(inner_tlist,
inner_node = (Plan *) make_noname(inner_tlist,
NIL,
NULL,
inner_node,
TEMP_MATERIAL);
NONAME_MATERIAL);
}
join_node = make_nestloop(tlist,
@@ -545,11 +545,11 @@ create_mergejoin_node(MergePath *best_path,
*/
if (best_path->outersortkeys)
{
Temp *sorted_outer_node = make_temp(outer_tlist,
Noname *sorted_outer_node = make_noname(outer_tlist,
best_path->outersortkeys,
outer_order,
outer_node,
TEMP_SORT);
NONAME_SORT);
sorted_outer_node->plan.cost = outer_node->cost;
outer_node = (Plan *) sorted_outer_node;
@@ -557,11 +557,11 @@ create_mergejoin_node(MergePath *best_path,
if (best_path->innersortkeys)
{
Temp *sorted_inner_node = make_temp(inner_tlist,
Noname *sorted_inner_node = make_noname(inner_tlist,
best_path->innersortkeys,
inner_order,
inner_node,
TEMP_SORT);
NONAME_SORT);
sorted_inner_node->plan.cost = outer_node->cost;
inner_node = (Plan *) sorted_inner_node;
@@ -798,7 +798,7 @@ switch_outer(List *clauses)
}
/*
* set-temp-tlist-operators--
* set-noname-tlist-operators--
* Sets the key and keyop fields of resdom nodes in a target list.
*
* 'tlist' is the target list
@@ -812,7 +812,7 @@ switch_outer(List *clauses)
* Returns the modified target list.
*/
static List *
set_temp_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
set_noname_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
{
Node *keys = NULL;
int keyno = 1;
@@ -846,8 +846,8 @@ set_temp_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
*****************************************************************************/
/*
* make_temp--
* Create plan nodes to sort or materialize relations into temporaries. The
* make_noname--
* Create plan nodes to sort or materialize relations into noname. The
* result returned for a sort will look like (SEQSCAN(SORT(plan-node)))
* or (SEQSCAN(MATERIAL(plan-node)))
*
@@ -856,46 +856,46 @@ set_temp_tlist_operators(List *tlist, List *pathkeys, Oid *operators)
* 'operators' is the operators with which the sort or hash is to be done
* (a list of operator OIDs)
* 'plan-node' is the node which yields tuples for the sort
* 'temptype' indicates which operation(sort or hash) to perform
* 'nonametype' indicates which operation(sort or hash) to perform
*/
static Temp *
make_temp(List *tlist,
static Noname *
make_noname(List *tlist,
List *keys,
Oid *operators,
Plan *plan_node,
int temptype)
int nonametype)
{
List *temp_tlist;
Temp *retval = NULL;
List *noname_tlist;
Noname *retval = NULL;
/* Create a new target list for the temporary, with keys set. */
temp_tlist = set_temp_tlist_operators(new_unsorted_tlist(tlist),
/* Create a new target list for the noname, with keys set. */
noname_tlist = set_noname_tlist_operators(new_unsorted_tlist(tlist),
keys,
operators);
switch (temptype)
switch (nonametype)
{
case TEMP_SORT:
retval = (Temp *) make_seqscan(tlist,
case NONAME_SORT:
retval = (Noname *) make_seqscan(tlist,
NIL,
_TEMP_RELATION_ID_,
(Plan *) make_sort(temp_tlist,
_TEMP_RELATION_ID_,
_NONAME_RELATION_ID_,
(Plan *) make_sort(noname_tlist,
_NONAME_RELATION_ID_,
plan_node,
length(keys)));
break;
case TEMP_MATERIAL:
retval = (Temp *) make_seqscan(tlist,
case NONAME_MATERIAL:
retval = (Noname *) make_seqscan(tlist,
NIL,
_TEMP_RELATION_ID_,
(Plan *) make_material(temp_tlist,
_TEMP_RELATION_ID_,
_NONAME_RELATION_ID_,
(Plan *) make_material(noname_tlist,
_NONAME_RELATION_ID_,
plan_node,
length(keys)));
break;
default:
elog(ERROR, "make_temp: unknown temp type %d", temptype);
elog(ERROR, "make_noname: unknown noname type %d", nonametype);
}
return retval;
@@ -1049,7 +1049,7 @@ make_mergejoin(List *tlist,
}
Sort *
make_sort(List *tlist, Oid tempid, Plan *lefttree, int keycount)
make_sort(List *tlist, Oid nonameid, Plan *lefttree, int keycount)
{
Sort *node = makeNode(Sort);
Plan *plan = &node->plan;
@@ -1060,7 +1060,7 @@ make_sort(List *tlist, Oid tempid, Plan *lefttree, int keycount)
plan->qual = NIL;
plan->lefttree = lefttree;
plan->righttree = NULL;
node->tempid = tempid;
node->nonameid = nonameid;
node->keycount = keycount;
return node;
@@ -1068,7 +1068,7 @@ make_sort(List *tlist, Oid tempid, Plan *lefttree, int keycount)
static Material *
make_material(List *tlist,
Oid tempid,
Oid nonameid,
Plan *lefttree,
int keycount)
{
@@ -1081,7 +1081,7 @@ make_material(List *tlist,
plan->qual = NIL;
plan->lefttree = lefttree;
plan->righttree = NULL;
node->tempid = tempid;
node->nonameid = nonameid;
node->keycount = keycount;
return node;
@@ -1145,7 +1145,7 @@ make_unique(List *tlist, Plan *lefttree, char *uniqueAttr)
plan->qual = NIL;
plan->lefttree = lefttree;
plan->righttree = NULL;
node->tempid = _TEMP_RELATION_ID_;
node->nonameid = _NONAME_RELATION_ID_;
node->keycount = 0;
if (strcmp(uniqueAttr, "*") == 0)
node->uniqueAttr = NULL;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.29 1998/10/01 02:03:59 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.30 1999/02/09 17:03:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -478,7 +478,7 @@ make_groupPlan(List **tlist,
}
sortplan = make_sort(sort_tlist,
_TEMP_RELATION_ID_,
_NONAME_RELATION_ID_,
subplan,
numCols);
sortplan->plan.cost = subplan->cost; /* XXX assume no cost */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.42 1999/02/03 21:16:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.43 1999/02/09 17:03:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -399,7 +399,7 @@ make_sortplan(List *tlist, List *sortcls, Plan *plannode)
}
sortplan = (Plan *) make_sort(temp_tlist,
_TEMP_RELATION_ID_,
_NONAME_RELATION_ID_,
(Plan *) plannode,
length(sortcls));

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.37 1999/02/03 21:16:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.38 1999/02/09 17:03:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,14 +34,14 @@
#include "optimizer/tlist.h"
static void set_join_tlist_references(Join *join);
static void set_tempscan_tlist_references(SeqScan *tempscan);
static void set_temp_tlist_references(Temp *temp);
static void set_nonamescan_tlist_references(SeqScan *nonamescan);
static void set_noname_tlist_references(Noname *noname);
static List *replace_clause_joinvar_refs(Expr *clause,
List *outer_tlist, List *inner_tlist);
static List *replace_subclause_joinvar_refs(List *clauses,
List *outer_tlist, List *inner_tlist);
static Var *replace_joinvar_refs(Var *var, List *outer_tlist, List *inner_tlist);
static List *tlist_temp_references(Oid tempid, List *tlist);
static List *tlist_noname_references(Oid nonameid, List *tlist);
static void replace_result_clause(Node *clause, List *subplanTargetList);
static bool OperandIsInner(Node *opnd, int inner_relid);
static List *replace_agg_clause(Node *expr, List *targetlist);
@@ -74,10 +74,10 @@ set_tlist_references(Plan *plan)
if (IsA_Join(plan))
set_join_tlist_references((Join *) plan);
else if (IsA(plan, SeqScan) &&plan->lefttree &&
IsA_Temp(plan->lefttree))
set_tempscan_tlist_references((SeqScan *) plan);
IsA_Noname(plan->lefttree))
set_nonamescan_tlist_references((SeqScan *) plan);
else if (IsA(plan, Sort))
set_temp_tlist_references((Temp *) plan);
set_noname_tlist_references((Noname *) plan);
else if (IsA(plan, Result))
set_result_tlist_references((Result *) plan);
else if (IsA(plan, Hash))
@@ -136,49 +136,49 @@ set_join_tlist_references(Join *join)
}
/*
* set-tempscan-tlist-references--
* Modifies the target list of a node that scans a temp relation (i.e., a
* sort or hash node) so that the varnos refer to the child temporary.
* set-nonamescan-tlist-references--
* Modifies the target list of a node that scans a noname relation (i.e., a
* sort or hash node) so that the varnos refer to the child noname.
*
* 'tempscan' is a seqscan node
* 'nonamescan' is a seqscan node
*
* Returns nothing of interest, but modifies internal fields of nodes.
*
*/
static void
set_tempscan_tlist_references(SeqScan *tempscan)
set_nonamescan_tlist_references(SeqScan *nonamescan)
{
Temp *temp = (Temp *) ((Plan *) tempscan)->lefttree;
Noname *noname = (Noname *) ((Plan *) nonamescan)->lefttree;
((Plan *) tempscan)->targetlist = tlist_temp_references(temp->tempid,
((Plan *) tempscan)->targetlist);
set_temp_tlist_references(temp);
((Plan *) nonamescan)->targetlist = tlist_noname_references(noname->nonameid,
((Plan *) nonamescan)->targetlist);
set_noname_tlist_references(noname);
}
/*
* set-temp-tlist-references--
* The temp's vars are made consistent with (actually, identical to) the
* modified version of the target list of the node from which temp node
* set-noname-tlist-references--
* The noname's vars are made consistent with (actually, identical to) the
* modified version of the target list of the node from which noname node
* receives its tuples.
*
* 'temp' is a temp (e.g., sort, hash) plan node
* 'noname' is a noname (e.g., sort, hash) plan node
*
* Returns nothing of interest, but modifies internal fields of nodes.
*
*/
static void
set_temp_tlist_references(Temp *temp)
set_noname_tlist_references(Noname *noname)
{
Plan *source = ((Plan *) temp)->lefttree;
Plan *source = ((Plan *) noname)->lefttree;
if (source != NULL)
{
set_tlist_references(source);
((Plan *) temp)->targetlist = copy_vars(((Plan *) temp)->targetlist,
((Plan *) noname)->targetlist = copy_vars(((Plan *) noname)->targetlist,
(source)->targetlist);
}
else
elog(ERROR, "calling set_temp_tlist_references with empty lefttree");
elog(ERROR, "calling set_noname_tlist_references with empty lefttree");
}
/*
@@ -475,25 +475,25 @@ replace_joinvar_refs(Var *var, List *outer_tlist, List *inner_tlist)
}
/*
* tlist-temp-references--
* Creates a new target list for a node that scans a temp relation,
* setting the varnos to the id of the temp relation and setting varids
* tlist-noname-references--
* Creates a new target list for a node that scans a noname relation,
* setting the varnos to the id of the noname relation and setting varids
* if necessary (varids are only needed if this is a targetlist internal
* to the tree, in which case the targetlist entry always contains a var
* node, so we can just copy it from the temp).
* node, so we can just copy it from the noname).
*
* 'tempid' is the id of the temp relation
* 'nonameid' is the id of the noname relation
* 'tlist' is the target list to be modified
*
* Returns new target list
*
*/
static List *
tlist_temp_references(Oid tempid,
tlist_noname_references(Oid nonameid,
List *tlist)
{
List *t_list = NIL;
TargetEntry *temp = (TargetEntry *) NULL;
TargetEntry *noname = (TargetEntry *) NULL;
TargetEntry *xtl = NULL;
List *entry;
@@ -507,16 +507,16 @@ tlist_temp_references(Oid tempid,
else
oattno = 0;
temp = makeTargetEntry(xtl->resdom,
(Node *) makeVar(tempid,
noname = makeTargetEntry(xtl->resdom,
(Node *) makeVar(nonameid,
xtl->resdom->resno,
xtl->resdom->restype,
xtl->resdom->restypmod,
0,
tempid,
nonameid,
oattno));
t_list = lappend(t_list, temp);
t_list = lappend(t_list, noname);
}
return t_list;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.10 1999/02/03 20:15:43 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.11 1999/02/09 17:03:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,8 +70,8 @@ get_base_rel(Query *root, int relid)
* If the relation is a materialized relation, assume
* constants for sizes.
*/
rel->pages = _TEMP_RELATION_PAGES_;
rel->tuples = _TEMP_RELATION_TUPLES_;
rel->pages = _NONAME_RELATION_PAGES_;
rel->tuples = _NONAME_RELATION_TUPLES_;
}
else