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

Functions for building and evaluating aggregate (GROUP BY) provenance, including the δ-semiring operator and semimodule multiplication. More...

Functions

UUID provsql.provenance_delta (UUID token)
 Create a δ-semiring gate wrapping a provenance token.
 
AGG_TOKEN provsql.provenance_aggregate (INTEGER aggfnoid, INTEGER aggtype, ANYELEMENT val, UUID[] tokens)
 Build an aggregate provenance gate from grouped tokens.
 
UUID provsql.provenance_semimod (ANYELEMENT val, UUID token)
 Create a semimodule scalar multiplication gate.
 

Detailed Description

Functions for building and evaluating aggregate (GROUP BY) provenance, including the δ-semiring operator and semimodule multiplication.

Function Documentation

◆ provenance_aggregate()

AGG_TOKEN provsql.provenance_aggregate ( INTEGER  aggfnoid,
INTEGER  aggtype,
ANYELEMENT  val,
UUID[]  tokens 
)

Build an aggregate provenance gate from grouped tokens.

Called internally by the query rewriter for GROUP BY queries. Creates an agg gate linking all contributing tokens and records the aggregate function OID and the computed scalar value.

Parameters
aggfnoidOID of the SQL aggregate function
aggtypeOID of the aggregate result type
valcomputed aggregate value
tokensarray of provenance tokens being aggregated
Source code
provsql.sql line 1167

◆ provenance_delta()

UUID provsql.provenance_delta ( UUID  token)

Create a δ-semiring gate wrapping a provenance token.

Used internally for aggregate provenance. Returns the token unchanged if it is gate_zero() or gate_one(), and gate_one() if the token is NULL.

◆ provenance_semimod()

UUID provsql.provenance_semimod ( ANYELEMENT  val,
UUID  token 
)

Create a semimodule scalar multiplication gate.

Pairs a scalar value with a provenance token, used internally by the query rewriter for aggregate provenance.

Parameters
valthe scalar value
tokenthe provenance token to multiply
Source code
provsql.sql line 1207