mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
Optimizer rename ClauseInfo -> RestrictInfo. Update optimizer README.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* clauseinfo.c--
|
||||
* ClauseInfo node manipulation routines.
|
||||
* restrictinfo.c--
|
||||
* RestrictInfo node manipulation routines.
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.9 1998/09/01 04:30:00 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.10 1999/02/03 20:15:39 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -18,21 +18,21 @@
|
||||
|
||||
#include "optimizer/internal.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/clauseinfo.h"
|
||||
#include "optimizer/restrictinfo.h"
|
||||
|
||||
/*
|
||||
* valid-or-clause--
|
||||
*
|
||||
* Returns t iff the clauseinfo node contains a 'normal' 'or' clause.
|
||||
* Returns t iff the restrictinfo node contains a 'normal' 'or' clause.
|
||||
*
|
||||
*/
|
||||
bool
|
||||
valid_or_clause(ClauseInfo * clauseinfo)
|
||||
valid_or_clause(RestrictInfo * restrictinfo)
|
||||
{
|
||||
if (clauseinfo != NULL &&
|
||||
!single_node((Node *) clauseinfo->clause) &&
|
||||
!clauseinfo->notclause &&
|
||||
or_clause((Node *) clauseinfo->clause))
|
||||
if (restrictinfo != NULL &&
|
||||
!single_node((Node *) restrictinfo->clause) &&
|
||||
!restrictinfo->notclause &&
|
||||
or_clause((Node *) restrictinfo->clause))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -41,19 +41,19 @@ valid_or_clause(ClauseInfo * clauseinfo)
|
||||
/*
|
||||
* get-actual-clauses--
|
||||
*
|
||||
* Returns a list containing the clauses from 'clauseinfo-list'.
|
||||
* Returns a list containing the clauses from 'restrictinfo-list'.
|
||||
*
|
||||
*/
|
||||
List *
|
||||
get_actual_clauses(List *clauseinfo_list)
|
||||
get_actual_clauses(List *restrictinfo_list)
|
||||
{
|
||||
List *temp = NIL;
|
||||
List *result = NIL;
|
||||
ClauseInfo *clause = (ClauseInfo *) NULL;
|
||||
RestrictInfo *clause = (RestrictInfo *) NULL;
|
||||
|
||||
foreach(temp, clauseinfo_list)
|
||||
foreach(temp, restrictinfo_list)
|
||||
{
|
||||
clause = (ClauseInfo *) lfirst(temp);
|
||||
clause = (RestrictInfo *) lfirst(temp);
|
||||
result = lappend(result, clause->clause);
|
||||
}
|
||||
return result;
|
||||
@@ -69,7 +69,7 @@ get_actual_clauses(List *clauseinfo_list)
|
||||
|
||||
/*
|
||||
* get_relattvals--
|
||||
* For each member of a list of clauseinfo nodes to be used with an
|
||||
* For each member of a list of restrictinfo nodes to be used with an
|
||||
* index, create a vectori-long specifying:
|
||||
* the attnos,
|
||||
* the values of the clause constants, and
|
||||
@@ -79,13 +79,13 @@ get_actual_clauses(List *clauseinfo_list)
|
||||
* flag indicating whether the constant is on the left or right should
|
||||
* always be *SELEC-CONSTANT-RIGHT*.
|
||||
*
|
||||
* 'clauseinfo-list' is a list of clauseinfo nodes
|
||||
* 'restrictinfo-list' is a list of restrictinfo nodes
|
||||
*
|
||||
* Returns a list of vectori-longs.
|
||||
*
|
||||
*/
|
||||
void
|
||||
get_relattvals(List *clauseinfo_list,
|
||||
get_relattvals(List *restrictinfo_list,
|
||||
List **attnos,
|
||||
List **values,
|
||||
List **flags)
|
||||
@@ -93,17 +93,17 @@ get_relattvals(List *clauseinfo_list,
|
||||
List *result1 = NIL;
|
||||
List *result2 = NIL;
|
||||
List *result3 = NIL;
|
||||
ClauseInfo *temp = (ClauseInfo *) NULL;
|
||||
RestrictInfo *temp = (RestrictInfo *) NULL;
|
||||
List *i = NIL;
|
||||
|
||||
foreach(i, clauseinfo_list)
|
||||
foreach(i, restrictinfo_list)
|
||||
{
|
||||
int dummy;
|
||||
AttrNumber attno;
|
||||
Datum constval;
|
||||
int flag;
|
||||
|
||||
temp = (ClauseInfo *) lfirst(i);
|
||||
temp = (RestrictInfo *) lfirst(i);
|
||||
get_relattval((Node *) temp->clause, &dummy, &attno, &constval, &flag);
|
||||
result1 = lappendi(result1, (int) attno);
|
||||
result2 = lappendi(result2, constval);
|
||||
@@ -118,7 +118,7 @@ get_relattvals(List *clauseinfo_list,
|
||||
|
||||
/*
|
||||
* get_joinvars --
|
||||
* Given a list of join clauseinfo nodes to be used with the index
|
||||
* Given a list of join restrictinfo nodes to be used with the index
|
||||
* of an inner join relation, return three lists consisting of:
|
||||
* the attributes corresponding to the inner join relation
|
||||
* the value of the inner var clause (always "")
|
||||
@@ -126,13 +126,13 @@ get_relattvals(List *clauseinfo_list,
|
||||
* the operator.
|
||||
*
|
||||
* 'relid' is the inner join relation
|
||||
* 'clauseinfo-list' is a list of qualification clauses to be used with
|
||||
* 'restrictinfo-list' is a list of qualification clauses to be used with
|
||||
* 'rel'
|
||||
*
|
||||
*/
|
||||
void
|
||||
get_joinvars(Oid relid,
|
||||
List *clauseinfo_list,
|
||||
List *restrictinfo_list,
|
||||
List **attnos,
|
||||
List **values,
|
||||
List **flags)
|
||||
@@ -142,10 +142,10 @@ get_joinvars(Oid relid,
|
||||
List *result3 = NIL;
|
||||
List *temp;
|
||||
|
||||
foreach(temp, clauseinfo_list)
|
||||
foreach(temp, restrictinfo_list)
|
||||
{
|
||||
ClauseInfo *clauseinfo = lfirst(temp);
|
||||
Expr *clause = clauseinfo->clause;
|
||||
RestrictInfo *restrictinfo = lfirst(temp);
|
||||
Expr *clause = restrictinfo->clause;
|
||||
|
||||
if (IsA(get_leftop(clause), Var) &&
|
||||
(relid == (get_leftop(clause))->varno))
|
||||
@@ -170,19 +170,19 @@ get_joinvars(Oid relid,
|
||||
/*
|
||||
* get_opnos--
|
||||
* Create and return a list containing the clause operators of each member
|
||||
* of a list of clauseinfo nodes to be used with an index.
|
||||
* of a list of restrictinfo nodes to be used with an index.
|
||||
*
|
||||
*/
|
||||
List *
|
||||
get_opnos(List *clauseinfo_list)
|
||||
get_opnos(List *restrictinfo_list)
|
||||
{
|
||||
ClauseInfo *temp = (ClauseInfo *) NULL;
|
||||
RestrictInfo *temp = (RestrictInfo *) NULL;
|
||||
List *result = NIL;
|
||||
List *i = NIL;
|
||||
|
||||
foreach(i, clauseinfo_list)
|
||||
foreach(i, restrictinfo_list)
|
||||
{
|
||||
temp = (ClauseInfo *) lfirst(i);
|
||||
temp = (RestrictInfo *) lfirst(i);
|
||||
result =
|
||||
lappendi(result,
|
||||
(((Oper *) temp->clause->oper)->opno));
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.10 1998/09/01 04:30:04 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.11 1999/02/03 20:15:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ find_secondary_index(Query *root, Oid relid)
|
||||
indexnode->unorderedpath = NULL;
|
||||
indexnode->cheapestpath = NULL;
|
||||
indexnode->pruneable = true;
|
||||
indexnode->clauseinfo = NIL;
|
||||
indexnode->restrictinfo = NIL;
|
||||
indexnode->joininfo = NIL;
|
||||
indexnode->innerjoin = NIL;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.12 1998/09/01 04:30:05 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.13 1999/02/03 20:15:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -71,7 +71,7 @@ find_joininfo_node(RelOptInfo * this_rel, List *join_relids)
|
||||
{
|
||||
joininfo = makeNode(JoinInfo);
|
||||
joininfo->otherrels = join_relids;
|
||||
joininfo->jinfoclauseinfo = NIL;
|
||||
joininfo->jinfo_restrictinfo = NIL;
|
||||
joininfo->mergejoinable = false;
|
||||
joininfo->hashjoinable = false;
|
||||
joininfo->inactive = false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.14 1999/02/02 23:53:25 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.15 1999/02/03 20:15:42 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "optimizer/internal.h"
|
||||
#include "optimizer/pathnode.h"
|
||||
#include "optimizer/clauseinfo.h"
|
||||
#include "optimizer/restrictinfo.h"
|
||||
#include "optimizer/plancat.h"
|
||||
#include "optimizer/cost.h"
|
||||
#include "optimizer/keys.h"
|
||||
@@ -209,11 +209,11 @@ create_seqscan_path(RelOptInfo * rel)
|
||||
pathnode->keys = NIL;
|
||||
|
||||
/*
|
||||
* copy clauseinfo list into path for expensive function processing --
|
||||
* copy restrictinfo list into path for expensive function processing --
|
||||
* JMH, 7/7/92
|
||||
*/
|
||||
pathnode->locclauseinfo =
|
||||
(List *) copyObject((Node *) rel->clauseinfo);
|
||||
pathnode->loc_restrictinfo =
|
||||
(List *) copyObject((Node *) rel->restrictinfo);
|
||||
|
||||
if (rel->relids != NULL)
|
||||
relid = lfirsti(rel->relids);
|
||||
@@ -263,11 +263,11 @@ create_index_path(Query *root,
|
||||
pathnode->indexqual = NIL;
|
||||
|
||||
/*
|
||||
* copy clauseinfo list into path for expensive function processing --
|
||||
* copy restrictinfo list into path for expensive function processing --
|
||||
* JMH, 7/7/92
|
||||
*/
|
||||
pathnode->path.locclauseinfo =
|
||||
set_difference((List *) copyObject((Node *) rel->clauseinfo),
|
||||
pathnode->path.loc_restrictinfo =
|
||||
set_difference((List *) copyObject((Node *) rel->restrictinfo),
|
||||
(List *) restriction_clauses);
|
||||
|
||||
/*
|
||||
@@ -410,11 +410,11 @@ create_nestloop_path(RelOptInfo * joinrel,
|
||||
pathnode->path.parent = joinrel;
|
||||
pathnode->outerjoinpath = outer_path;
|
||||
pathnode->innerjoinpath = inner_path;
|
||||
pathnode->pathclauseinfo = joinrel->clauseinfo;
|
||||
pathnode->pathinfo = joinrel->restrictinfo;
|
||||
pathnode->path.keys = keys;
|
||||
pathnode->path.joinid = NIL;
|
||||
pathnode->path.outerjoincost = (Cost) 0.0;
|
||||
pathnode->path.locclauseinfo = NIL;
|
||||
pathnode->path.loc_restrictinfo = NIL;
|
||||
|
||||
if (keys)
|
||||
{
|
||||
@@ -492,12 +492,12 @@ create_mergejoin_path(RelOptInfo * joinrel,
|
||||
pathnode->jpath.path.parent = joinrel;
|
||||
pathnode->jpath.outerjoinpath = outer_path;
|
||||
pathnode->jpath.innerjoinpath = inner_path;
|
||||
pathnode->jpath.pathclauseinfo = joinrel->clauseinfo;
|
||||
pathnode->jpath.pathinfo = joinrel->restrictinfo;
|
||||
pathnode->jpath.path.keys = keys;
|
||||
pathnode->jpath.path.p_ordering.ordtype = MERGE_ORDER;
|
||||
pathnode->jpath.path.p_ordering.ord.merge = order;
|
||||
pathnode->path_mergeclauses = mergeclauses;
|
||||
pathnode->jpath.path.locclauseinfo = NIL;
|
||||
pathnode->jpath.path.loc_restrictinfo = NIL;
|
||||
pathnode->outersortkeys = outersortkeys;
|
||||
pathnode->innersortkeys = innersortkeys;
|
||||
pathnode->jpath.path.path_cost =
|
||||
@@ -558,8 +558,8 @@ create_hashjoin_path(RelOptInfo * joinrel,
|
||||
pathnode->jpath.path.parent = joinrel;
|
||||
pathnode->jpath.outerjoinpath = outer_path;
|
||||
pathnode->jpath.innerjoinpath = inner_path;
|
||||
pathnode->jpath.pathclauseinfo = joinrel->clauseinfo;
|
||||
pathnode->jpath.path.locclauseinfo = NIL;
|
||||
pathnode->jpath.pathinfo = joinrel->restrictinfo;
|
||||
pathnode->jpath.path.loc_restrictinfo = NIL;
|
||||
pathnode->jpath.path.keys = keys;
|
||||
pathnode->jpath.path.p_ordering.ordtype = SORTOP_ORDER;
|
||||
pathnode->jpath.path.p_ordering.ord.sortop = NULL;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.9 1998/09/01 04:30:11 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.10 1999/02/03 20:15:43 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ get_base_rel(Query *root, int relid)
|
||||
rel->classlist = NULL;
|
||||
rel->ordering = NULL;
|
||||
rel->relam = InvalidOid;
|
||||
rel->clauseinfo = NIL;
|
||||
rel->restrictinfo = NIL;
|
||||
rel->joininfo = NIL;
|
||||
rel->innerjoin = NIL;
|
||||
rel->superrels = NIL;
|
||||
|
||||
Reference in New Issue
Block a user