![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Rewrite a single SELECT query to carry provenance. More...
Public Attributes | |
| List * | rtable |
| range table owning the joinaliasvars | |
| Bitmapset * | flattened |
| rtindexes of the RTE_JOIN entries being dissolved | |
| int | sublevels_up |
| current query nesting depth | |
| bool | wholerow |
| a whole-row Var references a dissolved join | |
Rewrite a single SELECT query to carry provenance.
This is the recursive entry point for the provenance rewriter. It is called from provsql_planner for top-level queries and re-entered from get_provenance_attributes for subqueries in FROM.
High-level steps:
provsql column propagated into this query's target list.get_provenance_attributes.build_column_map).| constants | Extension OID cache. |
| q | Query to rewrite (modified in place). |
| removed | Out-param: boolean array indicating which original target list entries were provenance columns and were removed. May be NULL if the caller does not need this info. |
| wrap_root | If true, mark this query's provenance expression as a safe-query root that must be wrapped in provsql.assume_boolean before splicing. |
| top_level | True for the outermost query the user evaluates; gates the inversion-free analysis (run only at the top). |
| in_boolean_rewrite | True once a safe-query (boolean) rewrite has fired above; propagated through every recursion (including into subqueries, where wrap_root is otherwise lost) so the joint-width recogniser defers to the safe rewrite everywhere in its subtree. |
| inv_ctx | Inversion-free marker context supplied by a parent that flattened this query as a subquery, or NULL; when set, this query applies the supplied per-input markers instead of running its own analysis or read-once rewrite. |
NULL if the query has no FROM clause and can be skipped.Context for the join-alias walker/mutator of normalize_inner_joins.
| Bitmapset* join_alias_ctx::flattened |
| List* join_alias_ctx::rtable |
| int join_alias_ctx::sublevels_up |
| bool join_alias_ctx::wholerow |