![]() |
ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Enumerations | |
| ENUM | PROVENANCE_GATE { input , plus , times , monus , project , zero , one , eq , agg , semimod , cmp , delta , value , mulinput , update , rv , arith , mixture , assumed , annotation , conditioned , name =() , kind , executable , operations , input_formats , output_format , parser , preference , enabled , argtpl , argtpl_circuit , endpoint , setup_search_path =() } |
| Provenance circuit gate types. More... | |
Functions | |
| TRIGGER | insert_statement_trigger () |
| Trigger function for INSERT statement provenance tracking. | |
| TRIGGER | update_statement_trigger () |
| Trigger function for UPDATE statement provenance tracking. | |
| TSTZMULTIRANGE | sr_temporal (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the temporal (interval-union) m-semiring. | |
| nummultirange | sr_interval_num (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the interval-union m-semiring with a NUMERIC multirange carrier. | |
| int4multirange | sr_interval_int (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the interval-union m-semiring with an int4 multirange carrier. | |
| TSTZMULTIRANGE | union_tstzintervals (UUID token, REGCLASS token2value) |
| Evaluate temporal provenance as a TIMESTAMP multirange. | |
| SETOF RECORD | timetravel (TEXT tablename, TIMESTAMPTZ at_time) |
| Query a table as it was at a specific point in time. | |
| SETOF RECORD | timeslice (TEXT tablename, TIMESTAMPTZ from_time, TIMESTAMPTZ to_time) |
| Query a table for rows valid during a time interval. | |
| SETOF RECORD | history (TEXT tablename, TEXT[] col_names, TEXT[] col_values) |
| Query the full temporal history of specific rows. | |
| TSTZMULTIRANGE | get_valid_time (UUID token, TEXT tablename) |
| Get the valid time range for a specific tuple. | |
| UUID | undo (UUID c) |
| Undo a previously recorded update operation. | |
| UUID | replace_the_circuit (UUID x, UUID c, UUID u) |
| Recursively rewrite a circuit to undo a specific operation. | |
Variables | |
| provsql | |
| Table recording the history of INSERT, UPDATE, DELETE, and UNDO operations. | |
| TEXT | query |
| QUERY_TYPE_ENUM | query_type |
| TEXT | username |
| TIMESTAMP | ts |
| TSTZMULTIRANGE | valid_time |
provsql schema
All types and functions introduced by ProvSQL are defined in the provsql schema, requiring prefixing them by provsql. or using PostgreSQL's search_path variable with a command such as
Provenance circuit gate types.
Each gate in the provenance circuit has a type that determines its semantics during semiring evaluation.
| Enumerator | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| input | Input (variable) gate of the circuit. | ||||||||||||||||||||||||||||||
| plus | Semiring plus. | ||||||||||||||||||||||||||||||
| times | Semiring times. | ||||||||||||||||||||||||||||||
| monus | M-Semiring monus. | ||||||||||||||||||||||||||||||
| project | Project gate (for where provenance). | ||||||||||||||||||||||||||||||
| zero | Semiring zero. | ||||||||||||||||||||||||||||||
| one | Semiring one. | ||||||||||||||||||||||||||||||
| eq | Equijoin gate (for where provenance). | ||||||||||||||||||||||||||||||
| agg | Aggregation operator (for aggregate provenance). | ||||||||||||||||||||||||||||||
| semimod | Semimodule scalar multiplication (for aggregate provenance). | ||||||||||||||||||||||||||||||
| cmp | Comparison of aggregate values (HAVING-clause provenance). | ||||||||||||||||||||||||||||||
| delta | δ-semiring operator (see Amsterdamer, Deutch, Tannen, PODS 2011) | ||||||||||||||||||||||||||||||
| value | Scalar value (for aggregate provenance). | ||||||||||||||||||||||||||||||
| mulinput | Multivalued input (for Boolean provenance). | ||||||||||||||||||||||||||||||
| update | Update operation. | ||||||||||||||||||||||||||||||
| rv | Continuous random-variable leaf. | ||||||||||||||||||||||||||||||
| arith | n-ary arithmetic gate over scalar-valued children | ||||||||||||||||||||||||||||||
| mixture | Probabilistic mixture of two scalar RV roots with a Bernoulli weight. | ||||||||||||||||||||||||||||||
| assumed | Structural assumption marker over a single child: the. | ||||||||||||||||||||||||||||||
| annotation | wrapped sub-circuit was computed under the assumption named by the gate's extra label 'BOOLEAN' (e.g. the safe-query rewrite; the default when the label is absent) or 'absorptive' (cyclic recursion truncated at the absorptive value fixpoint). Transparent for evaluation semirings satisfying the assumption, fatal error for the rest, rendered as an explicit element in PROV-XML export. Transparent single-child wrapper carrying a query-level annotation string in | ||||||||||||||||||||||||||||||
| conditioned | Conditioning marker: two children [target, evidence]. Evaluated only in the measure interpretation: probability_evaluate returns P(target ∧ evidence) / P(evidence }; | ||||||||||||||||||||||||||||||
| name | Return a DOT or TEXT visualization of the provenance circuit.
Return a DOT visualisation of the d-DNNF compiled from the provenance circuit Runs the requested external knowledge compiler and renders the resulting d-DNNF as a GraphViz digraph.
Return the compiled d-DNNF of a provenance circuit in the c2d / d4 ".nnf" TEXT interchange format. Companion to compile_to_ddnnf_dot (DOT, for viewing): this is the machine-readable form, suitable for feeding to an external d-DNNF reasoner / verifier or saving next to tseytin_cnf (same variable numbering). Accepts the same compiler / meta-route names.
Structural statistics of the d-DNNF a compiler produces for a provenance circuit. Compiles the circuit with the given compiler / meta-route (same names as compile_to_ddnnf_dot: d4, d4v2, c2d, minic2d, dsharp, panini-*, tree-decomposition, interpret-as-dd, default) and returns a jsonb object: nodes, edges, and / or / not / inputs counts, smooth, depth (longest path), treewidth (null when not computable), and compile_ms. Lets clients compare what each compiler produces on the same circuit.
Return the DIMACS CNF (Tseytin transformation) of the provenance circuit Returns the same encoding the extension writes to a temp file before invoking d4 / c2d / minic2d / dsharp. With
Map each DIMACS variable of tseytin_cnf back to its provenance input. Returns one row per input gate: the variable index (matching tseytin_cnf and compile_to_ddnnf's NNF), the original-circuit UUID of that input, and its probability. Lets a satisfying assignment or weighted model count obtained from an external tool be read against the provenance circuit.
Return a DOT visualisation of the tree decomposition of the provenance circuit Computes the min-fill decomposition used by the in-process knowledge compiler. The first line of the output is a comment of the form
Report whether an external tool is on the backend's resolved PATH Uses the same Names with a slash are treated as paths and tested directly via
Persistent overrides overlaid on the compiled-in tool seed. Each row is the complete desired RECORD for a tool (added or modified) keyed by logical Set-returning listing backing the
Read-only view of the registered tools. | ||||||||||||||||||||||||||||||
| kind | |||||||||||||||||||||||||||||||
| executable | |||||||||||||||||||||||||||||||
| operations | |||||||||||||||||||||||||||||||
| input_formats | |||||||||||||||||||||||||||||||
| output_format | |||||||||||||||||||||||||||||||
| parser | |||||||||||||||||||||||||||||||
| preference | |||||||||||||||||||||||||||||||
| enabled | |||||||||||||||||||||||||||||||
| argtpl | |||||||||||||||||||||||||||||||
| argtpl_circuit | |||||||||||||||||||||||||||||||
| endpoint | |||||||||||||||||||||||||||||||
| setup_search_path | Transition function for the choose aggregate (keeps first non-NULL value).
Aggregate that returns an arbitrary non-NULL value from a group
Explodes a table column containing aggregated provenance into multiple rows. For each row in the input table, this function unnests the children of the specified aggregate token column and produces one output row per child. It reconstructs the corresponding value and provenance (provsql) for each resulting row. The original table is replaced by the transformed table.
Append ProvSQL's operators and functions live in the Only new sessions pick up the change; the calling session keeps its current path. Role-level settings (if any) take precedence over the database-level setting and are left untouched. The caller must be the database owner or a superuser (the privilege model of
| ||||||||||||||||||||||||||||||