ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
provenance.c
Go to the documentation of this file.
1/**
2 * @file provenance.c
3 * @brief SQL function @c provenance() – error stub for untracked tables.
4 *
5 * The SQL function @c provsql.provenance() is added to every table that
6 * has provenance tracking enabled. When a query references the
7 * @c provsql column of such a table directly (without going through the
8 * planner hook), this stub is called and immediately raises an error.
9 *
10 * In normal operation the planner hook rewrites queries that reference
11 * provenance-tracked tables before this function can be called, so the
12 * error message is only seen if @c provenance() is invoked on a relation
13 * that does not have a @c provsql column.
14 */
15#include "postgres.h"
16#include "fmgr.h"
17#include "catalog/pg_type.h"
18#include "utils/uuid.h"
19#include "executor/spi.h"
20
21#include "provsql_utils.h"
22
23PG_FUNCTION_INFO_V1(provenance);
24
25/**
26 * @brief Error stub for @c provsql.provenance() on untracked tables.
27 *
28 * Always raises a @c provsql_error and never returns.
29 * @return Never returns (always raises an error).
30 */
31Datum provenance(PG_FUNCTION_ARGS)
32{
33 provsql_error("provenance() called on a table without provenance");
34}
Datum provenance(PG_FUNCTION_ARGS)
Error stub for provsql.provenance() on untracked tables.
Definition provenance.c:31
#define provsql_error(fmt,...)
Report a fatal ProvSQL error and abort the current transaction.
Core types, constants, and utilities shared across ProvSQL.