pub trait EngineHook {
Show 24 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 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 resolve_type_name(
&self,
_name: &str,
) -> Result<Option<ColumnType>, String> { ... }
fn resolve_regclass(&self, _name: &str) -> Result<Option<i64>, String> { ... }
fn resolve_regclass_input(&self, name: &str) -> Result<Option<i64>> { ... }
fn resolve_regprocedure(&self, _name: &str) -> Result<Option<i64>, String> { ... }
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>, String> { ... }
fn session_user(&self) -> Result<Option<String>, 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§
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 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 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_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_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>
Resolve the first existing schema on the logical session’s search
path. None lets standalone expression evaluation use its public
compatibility default.
fn current_user(&self) -> Result<Option<String>, String>
fn session_user(&self) -> Result<Option<String>, String>
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".