pub trait EngineHook {
Show 36 methods
// Required methods
fn nextval(&self, name: &str) -> Result<i64>;
fn currval(&self, name: &str) -> Result<i64>;
fn setval(&self, name: &str, value: i64, is_called: bool) -> Result<i64>;
// Provided methods
fn require_builtin_execute(&self, _binding: &FunctionBinding) -> Result<()> { ... }
fn transaction_timestamp_micros(&self) -> Option<i64> { ... }
fn statement_timestamp_micros(&self) -> Option<i64> { ... }
fn lastval(&self) -> Result<i64> { ... }
fn call_scalar_function(
&self,
_name: &str,
_args: &[Value],
) -> Option<Result<Value>> { ... }
fn call_bound_builtin_function(
&self,
_binding: &FunctionBinding,
_args: &[(Option<String>, Value)],
) -> Option<Result<Value>> { ... }
fn has_scalar_functions(&self) -> bool { ... }
fn enum_labels(&self) -> Option<&dyn EnumLabelCatalog> { ... }
fn composite_types(&self) -> Option<&dyn CompositeTypeCatalog> { ... }
fn resolve_type_name(
&self,
_name: &str,
) -> Result<Option<ColumnType>, String> { ... }
fn cast_domain(
&self,
_value: &Value,
_source: Option<&str>,
_target: &ColumnType,
) -> Result<Option<Value>> { ... }
fn resolve_regtype_input(&self, _name: &str) -> Result<Option<i64>> { ... }
fn resolve_regclass(&self, _name: &str) -> Result<Option<i64>, String> { ... }
fn resolve_regclass_input(&self, name: &str) -> Result<Option<i64>> { ... }
fn resolve_regproc(&self, _name: &str) -> Result<Option<i64>> { ... }
fn resolve_regprocedure(&self, _name: &str) -> Result<Option<i64>, String> { ... }
fn resolve_regprocedure_input(&self, name: &str) -> Result<Option<i64>> { ... }
fn resolve_regrole(&self, _name: &str) -> Result<Option<i64>> { ... }
fn resolve_regnamespace(&self, name: &str) -> Result<Option<i64>> { ... }
fn resolve_regobject(
&self,
ty: &ColumnType,
name: &str,
) -> Result<Option<i64>> { ... }
fn resolve_regtype_output(
&self,
_ty: &ColumnType,
_oid: i64,
) -> Result<Option<String>, String> { ... }
fn current_schema(&self) -> Result<Option<String>, String> { ... }
fn current_user(&self) -> Result<Option<String>, SQLError> { ... }
fn session_user(&self) -> Result<Option<String>, SQLError> { ... }
fn runtime_parameter(&self, _name: &str) -> Result<Option<String>> { ... }
fn sleep(&self, _duration: Duration) -> Result<()> { ... }
fn set_runtime_parameter(
&self,
_name: &str,
_value: Option<&str>,
_local: bool,
) -> Result<String> { ... }
fn current_schemas(
&self,
_include_implicit: bool,
) -> Result<Option<Vec<String>>, String> { ... }
fn random_value(&self) -> Result<Option<f64>, String> { ... }
fn random_u64(&self) -> Result<Option<u64>, String> { ... }
fn set_random_seed(&self, _seed: f64) -> Result<bool, String> { ... }
fn call_user_function(
&self,
_name: &str,
_args: &[(Option<String>, Value)],
) -> Option<Result<Value>> { ... }
fn call_bound_user_function(
&self,
_binding: &FunctionBinding,
_args: &[(Option<String>, Value)],
) -> Option<Result<Value>> { ... }
}Expand description
Engine-side hook that scalar function evaluation calls for stateful
sequence and user-defined functions. Query-valued expressions are not
accepted here: lowering assigns them physical query-plan slots executed by
uqa-execution::ScalarSubqueryRunner.
Required Methods§
fn nextval(&self, name: &str) -> Result<i64>
fn currval(&self, name: &str) -> Result<i64>
fn setval(&self, name: &str, value: i64, is_called: bool) -> Result<i64>
Provided Methods§
Sourcefn require_builtin_execute(&self, _binding: &FunctionBinding) -> Result<()>
fn require_builtin_execute(&self, _binding: &FunctionBinding) -> Result<()>
Enforce EXECUTE on a selected built-in at an execution boundary. Catalog-free embedders have no mutable routine ACLs.
Sourcefn transaction_timestamp_micros(&self) -> Option<i64>
fn transaction_timestamp_micros(&self) -> Option<i64>
Start of the current SQL transaction, in Unix microseconds.
Sourcefn statement_timestamp_micros(&self) -> Option<i64>
fn statement_timestamp_micros(&self) -> Option<i64>
Start of the current frontend SQL message, in Unix microseconds.
fn lastval(&self) -> Result<i64>
fn call_scalar_function( &self, _name: &str, _args: &[Value], ) -> Option<Result<Value>>
Sourcefn call_bound_builtin_function(
&self,
_binding: &FunctionBinding,
_args: &[(Option<String>, Value)],
) -> Option<Result<Value>>
fn call_bound_builtin_function( &self, _binding: &FunctionBinding, _args: &[(Option<String>, Value)], ) -> Option<Result<Value>>
Invoke an engine-backed built-in after an exact catalog binding has
selected it. Unlike call_scalar_function, this path is also available
when dynamic dispatch is disabled, so runtime callbacks cannot override
the stored built-in identity.
fn has_scalar_functions(&self) -> bool
Sourcefn enum_labels(&self) -> Option<&dyn EnumLabelCatalog>
fn enum_labels(&self) -> Option<&dyn EnumLabelCatalog>
Enum labels of the statement’s catalog. Embedders without catalog enum types keep the default, so enum input and output fail as an unavailable type.
Sourcefn composite_types(&self) -> Option<&dyn CompositeTypeCatalog>
fn composite_types(&self) -> Option<&dyn CompositeTypeCatalog>
Composite type attributes of the statement’s catalog. Embedders without catalog composite types keep the default, so composite input and coercion fail as an unavailable type.
Sourcefn resolve_type_name(&self, _name: &str) -> Result<Option<ColumnType>, String>
fn resolve_type_name(&self, _name: &str) -> Result<Option<ColumnType>, String>
Resolve a catalog-owned SQL type name for casts evaluated with an engine context.
Sourcefn cast_domain(
&self,
_value: &Value,
_source: Option<&str>,
_target: &ColumnType,
) -> Result<Option<Value>>
fn cast_domain( &self, _value: &Value, _source: Option<&str>, _target: &ColumnType, ) -> Result<Option<Value>>
Apply catalog-owned domain conversion and constraints. A missing implementation leaves built-in catalog domains on their base-type conversion path.
Sourcefn resolve_regtype_input(&self, _name: &str) -> Result<Option<i64>>
fn resolve_regtype_input(&self, _name: &str) -> Result<Option<i64>>
Resolve a regtype cast to its OID carrier when a complete type catalog is available.
Sourcefn resolve_regclass(&self, _name: &str) -> Result<Option<i64>, String>
fn resolve_regclass(&self, _name: &str) -> Result<Option<i64>, String>
Resolve a relation name to the OID carrier used by regclass.
Sourcefn resolve_regclass_input(&self, name: &str) -> Result<Option<i64>>
fn resolve_regclass_input(&self, name: &str) -> Result<Option<i64>>
Resolve regclass input while preserving typed SQL errors. Embedders that implement the historical string-error hook retain its previous behavior; engines with catalog privilege checks override this method directly.
Sourcefn resolve_regproc(&self, _name: &str) -> Result<Option<i64>>
fn resolve_regproc(&self, _name: &str) -> Result<Option<i64>>
Resolve a routine name that must name exactly one routine, as regproc input does.
Sourcefn resolve_regprocedure(&self, _name: &str) -> Result<Option<i64>, String>
fn resolve_regprocedure(&self, _name: &str) -> Result<Option<i64>, String>
Resolve an exact routine signature to the OID carrier used by regprocedure.
Sourcefn resolve_regprocedure_input(&self, name: &str) -> Result<Option<i64>>
fn resolve_regprocedure_input(&self, name: &str) -> Result<Option<i64>>
Resolve regprocedure input while preserving the typed errors regprocedurein reports. Embedders that implement only the historical lookup hook keep its behavior.
Sourcefn resolve_regrole(&self, _name: &str) -> Result<Option<i64>>
fn resolve_regrole(&self, _name: &str) -> Result<Option<i64>>
Resolve a regrole input while preserving hard input errors for direct casts.
Sourcefn resolve_regnamespace(&self, name: &str) -> Result<Option<i64>>
fn resolve_regnamespace(&self, name: &str) -> Result<Option<i64>>
Resolve a regnamespace input while preserving hard input errors for direct casts.
Sourcefn resolve_regobject(&self, ty: &ColumnType, name: &str) -> Result<Option<i64>>
fn resolve_regobject(&self, ty: &ColumnType, name: &str) -> Result<Option<i64>>
Resolve the text argument of one PostgreSQL to_reg* lookup function. The engine override owns catalog visibility and the lookup function’s NULL-versus-error boundary; the default preserves the two historical hooks for embedders that only implement regclass or regprocedure.
Sourcefn resolve_regtype_output(
&self,
_ty: &ColumnType,
_oid: i64,
) -> Result<Option<String>, String>
fn resolve_regtype_output( &self, _ty: &ColumnType, _oid: i64, ) -> Result<Option<String>, String>
Resolve one OID-backed alias type to its PostgreSQL text output.
Sourcefn current_schema(&self) -> Result<Option<String>, String>
fn current_schema(&self) -> Result<Option<String>, String>
The first schema of the session’s search path that exists and that the role may use, or None when there is none, which current_schema() reports as NULL. A hook without a session reports public, the first schema of the default search path.
fn current_user(&self) -> Result<Option<String>, SQLError>
fn session_user(&self) -> Result<Option<String>, SQLError>
Sourcefn runtime_parameter(&self, _name: &str) -> Result<Option<String>>
fn runtime_parameter(&self, _name: &str) -> Result<Option<String>>
Read a session setting. None means the parameter is unknown; errors must remain visible even for current_setting(..., true).
Sourcefn sleep(&self, _duration: Duration) -> Result<()>
fn sleep(&self, _duration: Duration) -> Result<()>
Sleep in the session for duration, ending at once when the statement is canceled or times out (pg_sleep).
Sourcefn set_runtime_parameter(
&self,
_name: &str,
_value: Option<&str>,
_local: bool,
) -> Result<String>
fn set_runtime_parameter( &self, _name: &str, _value: Option<&str>, _local: bool, ) -> Result<String>
Assign a session setting as set_config(name, value, is_local) does, restoring the reset setting for None, and return the new value as SHOW reports it.
Sourcefn current_schemas(
&self,
_include_implicit: bool,
) -> Result<Option<Vec<String>>, String>
fn current_schemas( &self, _include_implicit: bool, ) -> Result<Option<Vec<String>>, String>
Resolve the existing schemas visible to the logical session.
Sourcefn random_value(&self) -> Result<Option<f64>, String>
fn random_value(&self) -> Result<Option<f64>, String>
Draw from an engine-owned logical-session PRNG. None keeps pure,
engine-free expression evaluation available for library callers.
Sourcefn random_u64(&self) -> Result<Option<u64>, String>
fn random_u64(&self) -> Result<Option<u64>, String>
Draw every bit of one engine-owned logical-session PRNG word. Range
functions use this instead of a floating-point sample so bigint and
arbitrary-precision numeric bounds remain uniform.
Sourcefn set_random_seed(&self, _seed: f64) -> Result<bool, String>
fn set_random_seed(&self, _seed: f64) -> Result<bool, String>
Reseed the logical-session PRNG. false means the hook does not own a
mutable random stream and the caller must report the unsupported call.
Sourcefn call_user_function(
&self,
_name: &str,
_args: &[(Option<String>, Value)],
) -> Option<Result<Value>>
fn call_user_function( &self, _name: &str, _args: &[(Option<String>, Value)], ) -> Option<Result<Value>>
Invoke a user-defined SQL / PL/pgSQL function. Consulted
after built-in dispatch misses (and immediately for calls with
named arguments, which built-ins never accept). None means
no user-defined function with this name exists.
fn call_bound_user_function( &self, _binding: &FunctionBinding, _args: &[(Option<String>, Value)], ) -> Option<Result<Value>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".