Skip to main content

Module function_root_contract

Module function_root_contract 

Source
Expand description

The database contract of a query read from a function.

A query whose sql_source_kind is function is read as SELECT … FROM fn($1, …): the executor binds the query’s own arguments (auto-params left out) in declaration order, then one parameter per inject param, and reads the query’s jsonb_column from each row. The function must therefore exist with exactly that many input parameters, return a set, return that column as json/jsonb, and not be VOLATILE: a read may be cached, retried or served from a replica, and none of those is safe for a function that writes.

check_function_root answers that from catalog rows, so it is tested without a database; validate_function_roots reads the rows for every function root of a schema.

Functions§

check_function_root
What is wrong with the function query reads, given every overload of its name (candidates); empty when the read will bind and run.
function_roots
The queries of schema that read from a function.
validate_function_roots
Check every function root of schema against the database, as query \name` (sql_source: fn): problem` lines.