![]() |
ProvSQL SQL API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Installation-time advisory: if provsql is not in the database's default search_path, point the user at setup_search_path(). More...
Functions | |
| TRIGGER | provsql.insert_statement_trigger () |
| Trigger function for INSERT statement provenance tracking. | |
| TRIGGER | provsql.update_statement_trigger () |
| Trigger function for UPDATE statement provenance tracking. | |
Variables | |
| provsql.provsql | |
| Table recording the history of INSERT, UPDATE, DELETE, and UNDO operations. | |
| TEXT | provsql.query |
| QUERY_TYPE_ENUM | provsql.query_type |
| TEXT | provsql.username |
| TIMESTAMP | provsql.ts |
| TSTZMULTIRANGE | provsql.valid_time |
Installation-time advisory: if provsql is not in the database's default search_path, point the user at setup_search_path().
reset_val reflects the configured session default (postgresql.conf / ALTER DATABASE / ALTER ROLE), unaffected by the SET search_path statements this script ran. CREATE EXTENSION raises client_min_messages to WARNING for the duration of the script, so we lower it around the RAISE NOTICE. SET LOCAL only: it unwinds by itself when CREATE EXTENSION's transaction ends. An explicit save/restore here would capture the WARNING clamp (already in force when this block runs) and restore that at session level, leaving the whole installing session with NOTICEs suppressed. Final constants-cache refresh. The planned SELECT statements earlier in this script (reset_constants_cache itself, the zero/one create_gate calls) make the installing session memoize the OID constants mid-script, while objects defined later (notably the choose aggregate, used by the scalar-subquery decorrelation) do not exist yet. Their optional lookups then stay InvalidOid for the rest of the session, silently disabling the corresponding rewrites (e.g. IN/NOT IN over a tracked relation would raise "Subqueries ... not supported") until a new connection. Refreshing here, after every object exists, repairs the installing session's cache.
Extended provenance tracking for INSERT, UPDATE, DELETE, and UNDO operations, including temporal validity ranges.
| TRIGGER provsql.insert_statement_trigger | ( | ) |
Trigger function for INSERT statement provenance tracking.
Records the insertion in update_provenance and multiplies provenance tokens of inserted rows with the insert token.
| TRIGGER provsql.update_statement_trigger | ( | ) |
Trigger function for UPDATE statement provenance tracking.
Records the update in update_provenance. Multiplies new-row tokens with the update token and applies monus to old-row tokens.
| provsql.provsql |
Table recording the history of INSERT, UPDATE, DELETE, and UNDO operations.
Each row records one provenance-tracked modification, linking the operation's provenance token to metadata (query TEXT, type, user, TIMESTAMP) and the temporal validity range of the affected rows.
| TEXT provsql.query |
| QUERY_TYPE_ENUM provsql.query_type |
| TIMESTAMP provsql.ts |
| TEXT provsql.username |
| TSTZMULTIRANGE provsql.valid_time |