ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
fix_system.cpp File Reference

Resolution of the equation system of a recursive query. More...

#include "postgres.h"
#include "fmgr.h"
#include "catalog/pg_type.h"
#include "utils/array.h"
#include "utils/uuid.h"
#include "provsql_utils.h"
#include "provsql_mmap.h"
#include "gate_builders.h"
#include <algorithm>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
#include "CertifiedDDMaterialize.h"
#include "CircuitFromMMap.h"
#include "FixSystemGraph.h"
#include "GenericCircuit.h"
#include "provsql_interrupt.h"
#include "provsql_utils_cpp.h"
Include dependency graph for fix_system.cpp:

Go to the source code of this file.

Functions

Datum resolve_fix_system (PG_FUNCTION_ARGS)
 The token of each tuple of the equation system sys, in order.

Detailed Description

Resolution of the equation system of a recursive query.

eval_recursive_system records a recursion as one equation per derived tuple, x_i = f_i(x), gathered in a gate_fixsystem. Only the tuples derived through themselves need an unknown: a tuple outside every cycle of the dependency graph has a value that its right-hand side gives once the tuples it reads have theirs. resolve_fix_system walks the strongly connected components of that graph in solving order and gives each tuple its final token:

  • a tuple outside every cycle gets its right-hand side rebuilt with the unknowns replaced by the tokens of the tuples they stand for, by the rewriter's own gate builders: the gates, and their content addresses, are those a fixpoint iteration of the recursion would reach;
  • the tuples of a cyclic component get a gate_fixsystem of their own, whose right-hand sides read the tokens already resolved, and each a gate_fixpoint over it, solved at evaluation time.

A right-hand side with a gate the builders cannot rebuild leaves the system as it was: one gate_fixpoint per tuple over the whole system, which evaluation solves all the same.

Definition in file fix_system.cpp.

Function Documentation

◆ resolve_fix_system()

Datum resolve_fix_system ( PG_FUNCTION_ARGS )

The token of each tuple of the equation system sys, in order.

SQL: resolve_fix_system(sys uuid) RETURNS uuid[]. See the file documentation.

Definition at line 253 of file fix_system.cpp.

Here is the call graph for this function: