![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Public surface of the query-time TID / BID / OPAQUE classifier. More...
#include "postgres.h"#include "nodes/parsenodes.h"#include "nodes/pg_list.h"#include "MMappedTableInfo.h"

Go to the source code of this file.
Classes | |
| struct | ProvSQLClassification |
Result of provsql_classify_query. More... | |
Functions | |
| void | provsql_classify_query (Query *q, ProvSQLClassification *out) |
Classify the result relation of a parsed top-level Query. | |
| void | provsql_classify_emit_notice (const ProvSQLClassification *c) |
Render the result of provsql_classify_query as a NOTICE. | |
Variables | |
| bool | provsql_classify_top_level |
GUC: emit a classification NOTICE on every top-level SELECT. | |
Public surface of the query-time TID / BID / OPAQUE classifier.
The classifier is invoked by provsql_planner on the top-level Query when the provsql.classify_top_level GUC is on, and emits a NOTICE carrying the certified kind and the set of provenance-tracked base relations the query touches. Independent- TID join inference, BID block-key preservation under projection and GROUP BY, transitive ancestor-set computation through the per-relation registry, view descent, and ANSI INNER / CROSS JOIN handling all live in this same file's helpers and the matching propagation pre-passes in src/safe_query.c.
Definition in file classify_query.h.
|
extern |
Render the result of provsql_classify_query as a NOTICE.
Formats :
* ProvSQL: query result is TID (sources: schema.t1, schema.t2) * ProvSQL: query result is BID (sources: schema.t1) * ProvSQL: query result is TID (no provenance-tracked sources) * ProvSQL: query result is OPAQUE *
The OPAQUE form omits the parenthetical because the rtable walk only reaches syntactically visible sources : when the shape gate trips on a sublink, set operation, GROUP BY, ... the list would be partial and falsely suggest completeness.
Definition at line 713 of file classify_query.c.


|
extern |
Classify the result relation of a parsed top-level Query.
Scope :
fromlist of RangeTblRefs, with no kind-altering features (SubLinks, modifying CTEs, cteList, DISTINCT, GROUP BY, HAVING, aggregates, window functions, set-returning functions in the target list). Zero or one provenance-tracked base relation reached either directly (RTE_RELATION) or through any depth of RTE_SUBQUERY entries (view bodies after PG rewriting, inline FROM subqueries). The PG 18 virtual RTE_GROUP is skipped transparently. When a single tracked base relation is reached, the source's recorded kind is preserved verbatim. ORDER BY, LIMIT, OFFSET do not change row lineages and are therefore transparent.UNION ALL specialisation : a fully-UNION-ALL tree of subquery legs each of which classifies as TID over a base- relid set that is disjoint from every other leg's promotes to TID with the cumulative source list.n_meta >= 2 promotes to TID when every classifier-reported source is TID and the registered ancestor sets are pairwise disjoint.RTE_SUBQUERY TLE projection) and downgrades to OPAQUE when any block-key column is dropped.GROUP BY block-key promotion : a pre-dispatch special case promotes SELECT k FROM bid_t GROUP BY k to TID (each output row is one block).INNER / CROSS JOIN : the shape gate accepts JoinExpr fromlist entries when jointype == JOIN_INNER, recursing into both arms.| q | Parsed Query to classify. Read-only; not mutated. |
| out | Output struct. source_relids is built in the current memory context. |
Definition at line 638 of file classify_query.c.


|
extern |
GUC: emit a classification NOTICE on every top-level SELECT.
GUC: emit a classification NOTICE on every top-level SELECT.
Definition at line 56 of file classify_query.c.