![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
PostgreSQL I/O and constructor functions for the random_variable type.
More...
#include "postgres.h"#include "fmgr.h"#include "utils/uuid.h"#include "utils/fmgrprotos.h"
Go to the source code of this file.
Classes | |
| struct | random_variable |
Binary internal layout of random_variable. More... | |
Functions | |
| Datum | random_variable_in (PG_FUNCTION_ARGS) |
Parse a random_variable from its text representation. | |
| Datum | random_variable_out (PG_FUNCTION_ARGS) |
Render a random_variable as a hyphenated UUID string. | |
| Datum | random_variable_make (PG_FUNCTION_ARGS) |
Build a random_variable from a UUID. | |
PostgreSQL I/O and constructor functions for the random_variable type.
random_variable is a thin wrapper around a provenance gate UUID, used in user-facing SQL for continuous probabilistic c-tables.
On-disk and on-wire text format: the canonical xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx UUID form (identical to PostgreSQL's uuid). A binary-coercible random_variable -> uuid cast (declared WITHOUT FUNCTION since the two types share their byte layout) keeps SQL ergonomics: an rv-typed column flows directly into any function that accepts a uuid at zero runtime cost.
Definition in file random_variable_type.c.
| Datum random_variable_in | ( | PG_FUNCTION_ARGS | ) |
Parse a random_variable from its text representation.
Expected format: the standard hyphenated UUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, delegated to uuid_in. Raises ERROR on malformed input.
Definition at line 42 of file random_variable_type.c.
| Datum random_variable_make | ( | PG_FUNCTION_ARGS | ) |
Build a random_variable from a UUID.
Internal constructor used by the provsql.normal / provsql.uniform / provsql.exponential / provsql.as_random SQL constructors after they have created the backing gate. Equivalent in effect to the binary-coercible uuid -> random_variable cast (both reinterpret the same 16 bytes), but kept as a named function so the constructors read uniformly with the rest of the SQL surface.
Definition at line 75 of file random_variable_type.c.
| Datum random_variable_out | ( | PG_FUNCTION_ARGS | ) |
Render a random_variable as a hyphenated UUID string.
Definition at line 56 of file random_variable_type.c.