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

Functions that build provenance circuit gates for semiring operations. More...

Functions

UUID provsql.provenance_times (UUID[] tokens)
 Create a times (product) gate from multiple provenance tokens.
 
UUID provsql.provenance_monus (UUID token1, UUID token2)
 Create a monus (difference) gate from two provenance tokens.
 
UUID provsql.provenance_project (UUID token, INT[] positions)
 Create a project gate for where-provenance tracking.
 
UUID provsql.provenance_eq (UUID token, INT pos1, INT pos2)
 Create an equijoin gate for where-provenance tracking.
 
UUID provsql.provenance_plus (UUID[] tokens)
 Create a plus (sum) gate from an array of provenance tokens.
 
UUID provsql.provenance_cmp (UUID left_token, OID comparison_op, UUID right_token)
 Create a comparison gate for HAVING clause provenance.
 

Detailed Description

Functions that build provenance circuit gates for semiring operations.

These are called internally by the query rewriter.

Function Documentation

◆ provenance_cmp()

UUID provsql.provenance_cmp ( UUID  left_token,
OID  comparison_op,
UUID  right_token 
)

Create a comparison gate for HAVING clause provenance.

Parameters
left_tokenprovenance token for the left operand
comparison_opOID of the comparison operator
right_tokenprovenance token for the right operand
Source code
provsql.sql line 549

◆ provenance_eq()

UUID provsql.provenance_eq ( UUID  token,
INT  pos1,
INT  pos2 
)

Create an equijoin gate for where-provenance tracking.

Parameters
tokenchild provenance token
pos1attribute index in the first relation
pos2attribute index in the second relation
Source code
provsql.sql line 491

◆ provenance_monus()

UUID provsql.provenance_monus ( UUID  token1,
UUID  token2 
)

Create a monus (difference) gate from two provenance tokens.

Implements m-semiring monus. Returns token1 if token2 is NULL (used for LEFT OUTER JOIN semantics in the EXCEPT rewriting).

Source code
provsql.sql line 422

◆ provenance_plus()

UUID provsql.provenance_plus ( UUID[]  tokens)

Create a plus (sum) gate from an array of provenance tokens.

Filters out NULL and zero-gates; returns gate_zero() if all tokens are trivial, or a single token if only one remains.

Source code
provsql.sql line 512

◆ provenance_project()

UUID provsql.provenance_project ( UUID  token,
INT[]  positions 
)

Create a project gate for where-provenance tracking.

Records the mapping between input and output attribute positions.

Parameters
tokenchild provenance token
positionsarray encoding attribute position mappings
Source code
provsql.sql line 464

◆ provenance_times()

UUID provsql.provenance_times ( UUID[]  tokens)

Create a times (product) gate from multiple provenance tokens.

Filters out NULL and one-gates; returns gate_one() if all tokens are trivial, or a single token if only one remains.

Source code
provsql.sql line 392