~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/backend/nodes/nodeFuncs.c

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * nodeFuncs.c
 
4
 *        All node routines more complicated than simple access/modification
 
5
 *
 
6
 * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
 
7
 * Portions Copyright (c) 1994, Regents of the University of California
 
8
 *
 
9
 *
 
10
 * IDENTIFICATION
 
11
 *        $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.26 2004-12-31 21:59:55 pgsql Exp $
 
12
 *
 
13
 *-------------------------------------------------------------------------
 
14
 */
 
15
#include "postgres.h"
 
16
 
 
17
#include "nodes/nodeFuncs.h"
 
18
 
 
19
 
 
20
static bool var_is_inner(Var *var);
 
21
 
 
22
 
 
23
/*
 
24
 * single_node -
 
25
 *        Returns t if node corresponds to a single-noded expression
 
26
 */
 
27
bool
 
28
single_node(Node *node)
 
29
{
 
30
        if (IsA(node, Const) ||
 
31
                IsA(node, Var) ||
 
32
                IsA(node, Param))
 
33
                return true;
 
34
        else
 
35
                return false;
 
36
}
 
37
 
 
38
/*****************************************************************************
 
39
 *              VAR nodes
 
40
 *****************************************************************************/
 
41
 
 
42
/*
 
43
 *              var_is_outer
 
44
 *              var_is_inner
 
45
 *              var_is_mat
 
46
 *              var_is_rel
 
47
 *
 
48
 *              Returns t iff the var node corresponds to (respectively):
 
49
 *              the outer relation in a join
 
50
 *              the inner relation of a join
 
51
 *              a materialized relation
 
52
 *              a base relation (i.e., not an attribute reference, a variable from
 
53
 *                              some lower join level, or a sort result)
 
54
 *              var node is an array reference
 
55
 *
 
56
 */
 
57
bool
 
58
var_is_outer(Var *var)
 
59
{
 
60
        return (bool) (var->varno == OUTER);
 
61
}
 
62
 
 
63
static bool
 
64
var_is_inner(Var *var)
 
65
{
 
66
        return (bool) (var->varno == INNER);
 
67
}
 
68
 
 
69
bool
 
70
var_is_rel(Var *var)
 
71
{
 
72
        return (bool)
 
73
                !(var_is_inner(var) || var_is_outer(var));
 
74
}