Header And Logo

PostgreSQL
| The world's most advanced open source database.

Enumerations | Functions

var.h File Reference

#include "nodes/relation.h"
Include dependency graph for var.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  PVCAggregateBehavior { PVC_REJECT_AGGREGATES, PVC_INCLUDE_AGGREGATES, PVC_RECURSE_AGGREGATES }
enum  PVCPlaceHolderBehavior { PVC_REJECT_PLACEHOLDERS, PVC_INCLUDE_PLACEHOLDERS, PVC_RECURSE_PLACEHOLDERS }

Functions

Relids pull_varnos (Node *node)
Relids pull_varnos_of_level (Node *node, int levelsup)
void pull_varattnos (Node *node, Index varno, Bitmapset **varattnos)
Listpull_vars_of_level (Node *node, int levelsup)
bool contain_var_clause (Node *node)
bool contain_vars_of_level (Node *node, int levelsup)
int locate_var_of_level (Node *node, int levelsup)
Listpull_var_clause (Node *node, PVCAggregateBehavior aggbehavior, PVCPlaceHolderBehavior phbehavior)
Nodeflatten_join_alias_vars (PlannerInfo *root, Node *node)

Enumeration Type Documentation

Enumerator:
PVC_REJECT_AGGREGATES 
PVC_INCLUDE_AGGREGATES 
PVC_RECURSE_AGGREGATES 

Definition at line 19 of file var.h.

{
    PVC_REJECT_AGGREGATES,      /* throw error if Aggref found */
    PVC_INCLUDE_AGGREGATES,     /* include Aggrefs in output list */
    PVC_RECURSE_AGGREGATES      /* recurse into Aggref arguments */
} PVCAggregateBehavior;

Enumerator:
PVC_REJECT_PLACEHOLDERS 
PVC_INCLUDE_PLACEHOLDERS 
PVC_RECURSE_PLACEHOLDERS 

Definition at line 26 of file var.h.

{
    PVC_REJECT_PLACEHOLDERS,    /* throw error if PlaceHolderVar found */
    PVC_INCLUDE_PLACEHOLDERS,   /* include PlaceHolderVars in output list */
    PVC_RECURSE_PLACEHOLDERS    /* recurse into PlaceHolderVar arguments */
} PVCPlaceHolderBehavior;


Function Documentation

bool contain_var_clause ( Node node  ) 
bool contain_vars_of_level ( Node node,
int  levelsup 
)
Node* flatten_join_alias_vars ( PlannerInfo root,
Node node 
)

Definition at line 608 of file var.c.

References flatten_join_alias_vars_mutator(), Query::hasSubLinks, flatten_join_alias_vars_context::inserted_sublink, PlannerInfo::parse, flatten_join_alias_vars_context::possible_sublink, flatten_join_alias_vars_context::root, and flatten_join_alias_vars_context::sublevels_up.

Referenced by parseCheckAggregates(), preprocess_expression(), and subquery_planner().

{
    flatten_join_alias_vars_context context;

    context.root = root;
    context.sublevels_up = 0;
    /* flag whether join aliases could possibly contain SubLinks */
    context.possible_sublink = root->parse->hasSubLinks;
    /* if hasSubLinks is already true, no need to work hard */
    context.inserted_sublink = root->parse->hasSubLinks;

    return flatten_join_alias_vars_mutator(node, &context);
}

int locate_var_of_level ( Node node,
int  levelsup 
)

Definition at line 430 of file var.c.

References locate_var_of_level_walker(), query_or_expression_tree_walker(), locate_var_of_level_context::sublevels_up, and locate_var_of_level_context::var_location.

Referenced by checkExprIsVarFree(), and transformSetOperationTree().

{
    locate_var_of_level_context context;

    context.var_location = -1;  /* in case we find nothing */
    context.sublevels_up = levelsup;

    (void) query_or_expression_tree_walker(node,
                                           locate_var_of_level_walker,
                                           (void *) &context,
                                           0);

    return context.var_location;
}

List* pull_var_clause ( Node node,
PVCAggregateBehavior  aggbehavior,
PVCPlaceHolderBehavior  phbehavior 
)
void pull_varattnos ( Node node,
Index  varno,
Bitmapset **  varattnos 
)
Relids pull_varnos ( Node node  ) 
Relids pull_varnos_of_level ( Node node,
int  levelsup 
)

Definition at line 121 of file var.c.

References pull_varnos_walker(), query_or_expression_tree_walker(), pull_varnos_context::sublevels_up, and pull_varnos_context::varnos.

Referenced by is_simple_subquery().

{
    pull_varnos_context context;

    context.varnos = NULL;
    context.sublevels_up = levelsup;

    /*
     * Must be prepared to start with a Query or a bare expression tree; if
     * it's a Query, we don't want to increment sublevels_up.
     */
    query_or_expression_tree_walker(node,
                                    pull_varnos_walker,
                                    (void *) &context,
                                    0);

    return context.varnos;
}

List* pull_vars_of_level ( Node node,
int  levelsup 
)

Definition at line 256 of file var.c.

References pull_vars_walker(), query_or_expression_tree_walker(), pull_vars_context::sublevels_up, and pull_vars_context::vars.

Referenced by extract_lateral_references().

{
    pull_vars_context context;

    context.vars = NIL;
    context.sublevels_up = levelsup;

    /*
     * Must be prepared to start with a Query or a bare expression tree; if
     * it's a Query, we don't want to increment sublevels_up.
     */
    query_or_expression_tree_walker(node,
                                    pull_vars_walker,
                                    (void *) &context,
                                    0);

    return context.vars;
}