ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
safe_rewrite_atom Struct Reference

Per-atom rewrite metadata discovered by the hierarchy detector. More...

Public Attributes

Index rtindex
List * proj_slots
List * pushed_quals
int group_id
 -1 for atoms wrapped directly at the outer (one SELECT DISTINCT subquery per atom); >= 0 indexes into the rewrite's groups list and means the atom is a member of an inner sub-Query built around a partial-coverage shared class.
Index outer_rtindex
 Assigned by the rewriter: this atom's slot in the rebuilt outer rtable. Grouped atoms all share their group's outer_rtindex.
Index inner_rtindex
 Assigned by the rewriter for grouped atoms only: position inside the inner sub-Query's rtable (1-based). 0 for outer-wrap atoms.
AttrNumber root_anchor_attno
 For grouped atoms: base attno of the root-class binding column inside this atom. Used by the outer Var remap to recognise root-class references that should resolve to the inner sub-Query's single output column.
bool is_constant_pinned
 Reserved for future constant-selection follow-up work; currently never set (constant-pinned atoms are routed through the multi-component path before this struct is built, so each atom in rewrite_hierarchical_cq is unconditionally a regular hierarchical-component atom).

Detailed Description

Per-atom rewrite metadata discovered by the hierarchy detector.

rtindex is the 1-based index into q->rtable that matches Var.varno. proj_slots is the ordered list of safe_proj_slot * to project out of this atom's inner SELECT DISTINCT. The root-class slot is always first. Additional shared classes touching this atom (column pushdown) follow in ascending class-repr order.

pushed_quals is the list of WHERE conjuncts that reference only this atom (single-atom Vars only) and were extracted from the outer query before the hierarchy analysis ran. They are AND-injected into the inner subquery's WHERE after a varno remap from rtindex to 1, so the atom-local predicates evaluate before the DISTINCT and the offending single-atom Vars never reach the outer scope.

Definition at line 291 of file safe_query.c.

Member Data Documentation

◆ group_id

int safe_rewrite_atom::group_id

-1 for atoms wrapped directly at the outer (one SELECT DISTINCT subquery per atom); >= 0 indexes into the rewrite's groups list and means the atom is a member of an inner sub-Query built around a partial-coverage shared class.

Definition at line 295 of file safe_query.c.

◆ inner_rtindex

Index safe_rewrite_atom::inner_rtindex

Assigned by the rewriter for grouped atoms only: position inside the inner sub-Query's rtable (1-based). 0 for outer-wrap atoms.

Definition at line 297 of file safe_query.c.

◆ is_constant_pinned

bool safe_rewrite_atom::is_constant_pinned

Reserved for future constant-selection follow-up work; currently never set (constant-pinned atoms are routed through the multi-component path before this struct is built, so each atom in rewrite_hierarchical_cq is unconditionally a regular hierarchical-component atom).

Definition at line 299 of file safe_query.c.

◆ outer_rtindex

Index safe_rewrite_atom::outer_rtindex

Assigned by the rewriter: this atom's slot in the rebuilt outer rtable. Grouped atoms all share their group's outer_rtindex.

Definition at line 296 of file safe_query.c.

◆ proj_slots

List* safe_rewrite_atom::proj_slots

Definition at line 293 of file safe_query.c.

◆ pushed_quals

List* safe_rewrite_atom::pushed_quals

Definition at line 294 of file safe_query.c.

◆ root_anchor_attno

AttrNumber safe_rewrite_atom::root_anchor_attno

For grouped atoms: base attno of the root-class binding column inside this atom. Used by the outer Var remap to recognise root-class references that should resolve to the inner sub-Query's single output column.

Definition at line 298 of file safe_query.c.

◆ rtindex

Index safe_rewrite_atom::rtindex

Definition at line 292 of file safe_query.c.


The documentation for this struct was generated from the following file: