ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
Provenance table management

Functions for enabling, disabling, and configuring provenance tracking on user tables. More...

Functions

TRIGGER provsql.add_gate_trigger ()
 Trigger function that creates an input gate for each newly inserted row.
 
TRIGGER provsql.delete_statement_trigger ()
 Trigger function for DELETE statement provenance tracking.
 
VOID provsql.add_provenance (REGCLASS _tbl)
 Enable provenance tracking on an existing table.
 
VOID provsql.remove_provenance (REGCLASS _tbl)
 Remove provenance tracking from a table.
 
VOID provsql.repair_key (REGCLASS _tbl, TEXT key_att)
 Set up provenance for a table with duplicate key values.
 
VOID provsql.create_provenance_mapping (TEXT newtbl, REGCLASS oldtbl, TEXT att, BOOL preserve_case='f')
 Create a provenance mapping table from an attribute.
 

Detailed Description

Functions for enabling, disabling, and configuring provenance tracking on user tables.

Function Documentation

◆ add_gate_trigger()

TRIGGER provsql.add_gate_trigger ( )

Trigger function that creates an input gate for each newly inserted row.

Source code
provsql.sql line 153

◆ add_provenance()

VOID provsql.add_provenance ( REGCLASS  _tbl)

Enable provenance tracking on an existing table.

Adds a provsql UUID column to the table, creates input gates for all existing rows, and installs a trigger to track future inserts.

Parameters
_tblthe table to add provenance tracking to
Source code
provsql.sql line 215

◆ create_provenance_mapping()

VOID provsql.create_provenance_mapping ( TEXT  newtbl,
REGCLASS  oldtbl,
TEXT  att,
BOOL  preserve_case = 'f' 
)

Create a provenance mapping table from an attribute.

Creates a new table mapping provenance tokens to values of a given attribute, for use with semiring evaluation functions.

Parameters
newtblname of the mapping table to create
oldtblsource table with provenance tracking
attattribute whose values populate the mapping
preserve_caseif true, quote the table name to preserve case
Source code
provsql.sql line 324

◆ delete_statement_trigger()

TRIGGER provsql.delete_statement_trigger ( )

Trigger function for DELETE statement provenance tracking.

Records the deletion and applies monus to provenance tokens of deleted rows. This is the version for PostgreSQL < 14.

Source code
provsql.sql line 170

◆ remove_provenance()

VOID provsql.remove_provenance ( REGCLASS  _tbl)

Remove provenance tracking from a table.

Drops the provsql column and associated triggers.

Parameters
_tblthe table to remove provenance tracking from
Source code
provsql.sql line 232

◆ repair_key()

VOID provsql.repair_key ( REGCLASS  _tbl,
TEXT  key_att 
)

Set up provenance for a table with duplicate key values.

When a table has duplicate rows for a given key, this function replaces simple input gates with multivalued input (mulinput) gates that model a uniform distribution over duplicates.

Parameters
_tblthe table to repair
key_attthe key attribute(s) as a comma-separated string, or empty string if the whole table is one group
Source code
provsql.sql line 262