![]() |
ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Functions for temporal database support. More...
Functions | |
| TSTZMULTIRANGE | provsql.sr_temporal (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the temporal (interval-union) m-semiring. | |
| nummultirange | provsql.sr_interval_num (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the interval-union m-semiring with a NUMERIC multirange carrier. | |
| int4multirange | provsql.sr_interval_int (ANYELEMENT token, REGCLASS token2value) |
| Evaluate provenance over the interval-union m-semiring with an int4 multirange carrier. | |
| TSTZMULTIRANGE | provsql.union_tstzintervals (UUID token, REGCLASS token2value) |
| Evaluate temporal provenance as a TIMESTAMP multirange. | |
| SETOF RECORD | provsql.timetravel (TEXT tablename, TIMESTAMPTZ at_time) |
| Query a table as it was at a specific point in time. | |
| SETOF RECORD | provsql.timeslice (TEXT tablename, TIMESTAMPTZ from_time, TIMESTAMPTZ to_time) |
| Query a table for rows valid during a time interval. | |
| SETOF RECORD | provsql.history (TEXT tablename, TEXT[] col_names, TEXT[] col_values) |
| Query the full temporal history of specific rows. | |
| TSTZMULTIRANGE | provsql.get_valid_time (UUID token, TEXT tablename) |
| Get the valid time range for a specific tuple. | |
| UUID | provsql.undo (UUID c) |
| Undo a previously recorded update operation. | |
| UUID | provsql.replace_the_circuit (UUID x, UUID c, UUID u) |
| Recursively rewrite a circuit to undo a specific operation. | |
Functions for temporal database support.
These use provenance evaluation over the multirange semiring to track temporal validity of tuples.
| TSTZMULTIRANGE provsql.get_valid_time | ( | UUID | token, |
| TEXT | tablename ) |
Get the valid time range for a specific tuple.
| token | provenance token of the tuple |
| tablename | name of the table containing the tuple |
| SETOF RECORD provsql.history | ( | TEXT | tablename, |
| TEXT[] | col_names, | ||
| TEXT[] | col_values ) |
Query the full temporal history of specific rows.
Returns all versions of rows matching the given column values, with their temporal validity ranges.
| tablename | name of the provenance-tracked table |
| col_names | array of column names to filter on |
| col_values | array of corresponding values to match |
| UUID provsql.replace_the_circuit | ( | UUID | x, |
| UUID | c, | ||
| UUID | u ) |
Recursively rewrite a circuit to undo a specific operation.
Helper for undo(). Walks the circuit and replaces occurrences of the target update gate with its monus.
| x | provenance token to rewrite |
| c | UUID of the update operation to undo |
| u | UUID of the undo operation |
| int4multirange provsql.sr_interval_int | ( | ANYELEMENT | token, |
| REGCLASS | token2value ) |
Evaluate provenance over the interval-union m-semiring with an int4 multirange carrier.
Inputs are read as int4multirange validity ranges over the integers (e.g. page or line ranges of supporting documents). Addition is multirange union, multiplication is intersection, monus is set difference; the additive identity is '{}'::int4multirange and the multiplicative identity is '{(,)}'::int4multirange.
| token | Provenance token to evaluate. |
| token2value | Mapping from input gates to int4 multiranges. |
| nummultirange provsql.sr_interval_num | ( | ANYELEMENT | token, |
| REGCLASS | token2value ) |
Evaluate provenance over the interval-union m-semiring with a NUMERIC multirange carrier.
Inputs are read as nummultirange validity ranges over a NUMERIC domain (e.g. sensor measurement-validity ranges). Addition is multirange union, multiplication is intersection, monus is set difference; the additive identity is '{}'::nummultirange and the multiplicative identity is '{(,)}'::nummultirange (universal range).
| token | Provenance token to evaluate. |
| token2value | Mapping from input gates to NUMERIC multiranges. |
| TSTZMULTIRANGE provsql.sr_temporal | ( | ANYELEMENT | token, |
| REGCLASS | token2value ) |
Evaluate provenance over the temporal (interval-union) m-semiring.
Inputs are read as TSTZMULTIRANGE validity intervals; the additive identity is '{}'::TSTZMULTIRANGE (empty), the multiplicative identity is '{(,)}'::TSTZMULTIRANGE (universal). Returns the union of intervals supporting the result, computed via the compiled circuit traversal.
| token | Provenance token to evaluate. |
| token2value | Mapping from input gates to validity multiranges. |
| SETOF RECORD provsql.timeslice | ( | TEXT | tablename, |
| TIMESTAMPTZ | from_time, | ||
| TIMESTAMPTZ | to_time ) |
Query a table for rows valid during a time interval.
Returns all rows whose temporal validity overlaps the given range.
| tablename | name of the provenance-tracked table |
| from_time | start of the time interval |
| to_time | end of the time interval |
| SETOF RECORD provsql.timetravel | ( | TEXT | tablename, |
| TIMESTAMPTZ | at_time ) |
Query a table as it was at a specific point in time.
Returns all rows whose temporal validity includes the given TIMESTAMP.
| tablename | name of the provenance-tracked table |
| at_time | the point in time to query |
| UUID provsql.undo | ( | UUID | c | ) |
Undo a previously recorded update operation.
Traverses all provenance-tracked tables and rewrites their circuits to apply monus with respect to the given update token, effectively undoing the operation.
| c | UUID of the update operation to undo (from update_provenance) |
| TSTZMULTIRANGE provsql.union_tstzintervals | ( | UUID | token, |
| REGCLASS | token2value ) |
Evaluate temporal provenance as a TIMESTAMP multirange.
Thin wrapper around :sqlfunc:sr_temporal retained for backward compatibility; both compute the same union of validity intervals.
| token | provenance token to evaluate |
| token2value | mapping table from tokens to temporal validity ranges |