OSDN Git Service

Change Copyright from PostgreSQL, Inc to PostgreSQL Global Development Group.
[pg-rex/syncrep.git] / src / backend / optimizer / util / joininfo.c
index 82602c1..81bb3bb 100644 (file)
@@ -3,23 +3,21 @@
  * joininfo.c
  *       JoinInfo node manipulation routines
  *
- * Copyright (c) 1994, Regents of the University of California
+ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.21 1999/05/25 22:41:47 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.28 2001/01/24 19:43:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
 
-#include "nodes/relation.h"
 
-#include "optimizer/internal.h"
 #include "optimizer/joininfo.h"
-#include "optimizer/var.h"
-#include "optimizer/clauses.h"
 
+static JoinInfo *joininfo_member(List *join_relids, List *joininfo_list);
 
 /*
  * joininfo_member
@@ -35,7 +33,7 @@
  * exists.
  *
  */
-JoinInfo   *
+static JoinInfo   *
 joininfo_member(List *join_relids, List *joininfo_list)
 {
        List       *i;
@@ -44,7 +42,7 @@ joininfo_member(List *join_relids, List *joininfo_list)
        {
                JoinInfo   *joininfo = (JoinInfo *) lfirst(i);
 
-               if (same(join_relids, joininfo->unjoined_relids))
+               if (sameseti(join_relids, joininfo->unjoined_relids))
                        return joininfo;
        }
        return NULL;
@@ -54,8 +52,8 @@ joininfo_member(List *join_relids, List *joininfo_list)
 /*
  * find_joininfo_node
  *       Find the joininfo node within a relation entry corresponding
- *       to a join between 'this_rel' and the relations in 'join_relids'.      A
- *       new node is created and added to the relation entry's joininfo
+ *       to a join between 'this_rel' and the relations in 'join_relids'.
+ *       new node is created and added to the relation entry's joininfo
  *       field if the desired one can't be found.
  *
  * Returns a joininfo node.
@@ -72,40 +70,7 @@ find_joininfo_node(RelOptInfo *this_rel, Relids join_relids)
                joininfo = makeNode(JoinInfo);
                joininfo->unjoined_relids = join_relids;
                joininfo->jinfo_restrictinfo = NIL;
-               joininfo->mergejoinable = false;
-               joininfo->hashjoinable = false;
                this_rel->joininfo = lcons(joininfo, this_rel->joininfo);
        }
        return joininfo;
 }
-
-/*
- * other_join_clause_var
- *       Determines whether a var node is contained within a joinclause
- *       of the form(op var var).
- *
- * Returns the other var node in the joinclause if it is, nil if not.
- *
- */
-Var *
-other_join_clause_var(Var *var, Expr *clause)
-{
-       Var                *retval;
-       Var                *l,
-                          *r;
-
-       retval = (Var *) NULL;
-
-       if (var != NULL && is_joinable((Node *) clause))
-       {
-               l = (Var *) get_leftop(clause);
-               r = (Var *) get_rightop(clause);
-
-               if (equal(var, l))
-                       retval = r;
-               else if (equal(var, r))
-                       retval = l;
-       }
-
-       return retval;
-}