![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Implementation of the shared predicate-tree classification helpers. More...
#include "postgres.h"#include "nodes/parsenodes.h"#include "nodes/pg_list.h"#include "nodes/bitmapset.h"#include "nodes/makefuncs.h"#include "nodes/nodeFuncs.h"#include "optimizer/clauses.h"#include "qual_classify.h"#include "provsql_utils.h"
Go to the source code of this file.
Functions | |
| bool | qc_collect_vars_walker (Node *node, qc_vars_ctx *ctx) |
Tree walker that collects every distinct base-level Var node (varlevelsup == 0), deduplicated by (varno, varattno). | |
| int | qc_var_index (List *vars, Index varno, AttrNumber varattno) |
Position of a Var inside vars (matched on (varno, varattno)); -1 if absent. | |
| bool | qc_is_var_eq (Expr *qual, Var **l, Var **r) |
Recognise a conjunct equating two base Vars (the canonical equality for the operand types, through RelabelType casts). | |
| bool | qc_is_var_const_eq (Expr *qual, Var **var, Const **konst) |
Recognise a conjunct of shape Var=Const (either order, through RelabelType casts; non-NULL literal, canonical equality). | |
| void | qc_collect_equalities (Node *quals, List **out) |
Walk quals as an AND tree, appending each Var=Var equijoin's two Vars (left, right) to *out. | |
| bool | qc_collect_varnos_walker (Node *node, qc_varnos_ctx *ctx) |
Collect the distinct base-level varno values referenced by a sub-tree (used to tell a single-relation selection from a cross-relation predicate). | |
| void | qc_flatten_and (Node *n, List **out) |
Flatten the top-level AND tree of a qual into a flat list of leaf conjuncts (a bare List is an implicit AND). | |
| void | qc_split_quals (Node *quals, int natoms, List **per_atom_out, Node **out_residual) |
| Partition top-level conjuncts into atom-local selections and the cross-atom residual. | |
Implementation of the shared predicate-tree classification helpers.
See qual_classify.h.
Definition in file qual_classify.c.
| void qc_collect_equalities | ( | Node * | quals, |
| List ** | out ) |
Walk quals as an AND tree, appending each Var=Var equijoin's two Vars (left, right) to *out.
OR / NOT are not traversed (they are not equijoins).
Definition at line 126 of file qual_classify.c.


| bool qc_collect_varnos_walker | ( | Node * | node, |
| qc_varnos_ctx * | ctx ) |
Collect the distinct base-level varno values referenced by a sub-tree (used to tell a single-relation selection from a cross-relation predicate).
Definition at line 154 of file qual_classify.c.


| bool qc_collect_vars_walker | ( | Node * | node, |
| qc_vars_ctx * | ctx ) |
Tree walker that collects every distinct base-level Var node (varlevelsup == 0), deduplicated by (varno, varattno).
Definition at line 21 of file qual_classify.c.


| void qc_flatten_and | ( | Node * | n, |
| List ** | out ) |
Flatten the top-level AND tree of a qual into a flat list of leaf conjuncts (a bare List is an implicit AND).
The result shares pointers with the input; copyObject before mutating.
Definition at line 167 of file qual_classify.c.


| bool qc_is_var_const_eq | ( | Expr * | qual, |
| Var ** | var, | ||
| Const ** | konst ) |
Recognise a conjunct of shape Var=Const (either order, through RelabelType casts; non-NULL literal, canonical equality).
Fills *var, *konst on match.
Definition at line 86 of file qual_classify.c.


| bool qc_is_var_eq | ( | Expr * | qual, |
| Var ** | l, | ||
| Var ** | r ) |
Recognise a conjunct equating two base Vars (the canonical equality for the operand types, through RelabelType casts).
Fills *l, *r on match.
Definition at line 54 of file qual_classify.c.


| void qc_split_quals | ( | Node * | quals, |
| int | natoms, | ||
| List ** | per_atom_out, | ||
| Node ** | out_residual ) |
Partition top-level conjuncts into atom-local selections and the cross-atom residual.
per_atom_out is a caller-allocated, zero-initialised array of length natoms; a conjunct whose base Vars all reference a single varno (1..natoms) and that is non-volatile lands in that atom's list, the rest in *out_residual (rebuilt as NULL / the lone conjunct / a fresh AND). Volatile predicates stay in the residual (the inner DISTINCT must not change their evaluation count).
Definition at line 186 of file qual_classify.c.


| int qc_var_index | ( | List * | vars, |
| Index | varno, | ||
| AttrNumber | varattno ) |
Position of a Var inside vars (matched on (varno, varattno)); -1 if absent.
Definition at line 41 of file qual_classify.c.
