Skip to content

Evaluation Engine

pghf.evaluate_run(p_run_id uuid)

The evaluation dispatch engine. Judges one already-collected run's raw results against configured thresholds, one row per check: skipped or errored raw results become 'unknown'; a threshold with a custom evaluator attached is dispatched to it; a threshold without one goes through the built-in, direction-aware comparator; no threshold at all is 'not_evaluable'. Applies debounce to produce the confirmed severity, then fires any qualifying events. Commits after each check. Deliberately not SECURITY DEFINER — the same reasoning as the collection engine: a custom evaluator is dynamic dispatch of a function read out of a table. Must be invoked as a standalone CALL statement.

Parameter Type Mandatory Default Description
p_run_id uuid Yes An already-collected run. Must exist.

Returns: nothing. This is a procedure. Writes one evaluation record per raw result.

pghf.run_and_evaluate(p_run_key text DEFAULT NULL, p_check_run_id uuid DEFAULT NULL, INOUT p_run_id uuid DEFAULT NULL, p_target_version int DEFAULT NULL, p_amcheck_tables text[] DEFAULT NULL, p_pg_visibility_tables text[] DEFAULT NULL)

Convenience wrapper: calls the collection engine, then the evaluation engine, in a single CALL. Same parameters as pghf.execute_check_run(). This works only because it's a procedure calling two other procedures that each commit internally — wrapping either one in an ordinary function instead would fail. Deliberately not SECURITY DEFINER, for the same reason as its two callees. Must be invoked as a standalone CALL statement.

Parameter Type Mandatory Default Description
p_run_key text One of p_run_key/p_check_run_id required empty Suite to run, by name.
p_check_run_id uuid One of p_run_key/p_check_run_id required empty Suite to run, by internal identifier.
p_run_id uuid (input/output) No empty = a new one is generated Same as pghf.execute_check_run().
p_target_version int No empty Same as pghf.execute_check_run().
p_amcheck_tables text[] No empty Same as pghf.execute_check_run().
p_pg_visibility_tables text[] No empty Same as pghf.execute_check_run().

Returns: the run ID, via the input/output parameter. Reading results back out afterward is still a separate call — see Reporting.

Continue to Built-in Custom Evaluators.