Skip to main content

EngineHook

Trait EngineHook 

Source
pub trait EngineHook {
Show 55 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 sql_notice(&self, _notice: SQLNotice) { ... } fn require_builtin_execute(&self, _binding: &FunctionBinding) -> Result<()> { ... } fn require_builtin_execute_with_control( &self, binding: &FunctionBinding, control: &ProductionControl<'_>, ) -> 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 call_bound_builtin_function_with_control( &self, binding: &FunctionBinding, args: &[(Option<String>, Value)], control: &ProductionControl<'_>, ) -> Option<Result<Produced<Value>>> { ... } fn has_scalar_functions(&self) -> bool { ... } fn enum_labels(&self) -> Option<&dyn EnumLabelCatalog> { ... } fn composite_types(&self) -> Option<&dyn CompositeTypeCatalog> { ... } fn read_range_input( &self, oid: u32, _text: &str, _control: &ProductionControl<'_>, ) -> Result<Produced<Value>> { ... } fn construct_range( &self, oid: u32, _bounds: RangeBoundsInput, _control: &ProductionControl<'_>, ) -> Result<Produced<Value>> { ... } fn construct_multirange( &self, oid: u32, _members: &[Value], _control: &ProductionControl<'_>, ) -> Result<Produced<Value>> { ... } fn catalog_cast_scope(&self) -> Option<&CatalogCastScope> { ... } fn resolve_type_name( &self, _name: &str, ) -> Result<Option<ColumnType>, String> { ... } fn resolve_type_oid(&self, _oid: u32) -> Result<Option<ColumnType>, String> { ... } fn resolve_type_name_with_control( &self, name: &str, control: &ProductionControl<'_>, ) -> Result<Option<Produced<ColumnType>>> { ... } fn resolve_type_oid_with_control( &self, oid: u32, control: &ProductionControl<'_>, ) -> Result<Option<Produced<ColumnType>>> { ... } fn type_oid_exists(&self, oid: u32) -> Result<bool, String> { ... } fn cast_domain( &self, _value: &Value, _source: Option<&str>, _target: &ColumnType, ) -> Result<Option<Value>> { ... } fn cast_domain_with_control( &self, value: &Value, source: Option<&str>, target: &ColumnType, control: &ProductionControl<'_>, ) -> Result<Option<Produced<Value>>> { ... } fn resolve_oid_alias_input_with_control( &self, ty: &ColumnType, name: &str, control: &ProductionControl<'_>, ) -> Result<Option<i64>> { ... } 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_regcollation(&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 temporal_interval_style(&self) -> Result<Option<TemporalIntervalStyle>> { ... } fn temporal_time_zone(&self) -> Result<Option<TemporalTimeZone>> { ... } 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>> { ... } fn call_bound_user_function_with_control( &self, binding: &FunctionBinding, args: &[(Option<String>, Value)], control: &ProductionControl<'_>, ) -> Option<Result<Produced<Value>>> { ... } fn routine_description_scope(&self) -> Option<RoutineDescriptionScope> { ... } fn call_bound_user_function_with_descriptions( &self, binding: &FunctionBinding, args: &[(Option<String>, Value)], _descriptions: &RoutineCallDescriptions, _control: &ProductionControl<'_>, ) -> 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§

Source

fn nextval(&self, name: &str) -> Result<i64>

Source

fn currval(&self, name: &str) -> Result<i64>

Source

fn setval(&self, name: &str, value: i64, is_called: bool) -> Result<i64>

Provided Methods§

Source

fn sql_notice(&self, _notice: SQLNotice)

Retain a diagnostic reported by a type input or scalar operation without failing it.

Source

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.

Source

fn require_builtin_execute_with_control( &self, binding: &FunctionBinding, control: &ProductionControl<'_>, ) -> Result<()>

External hooks own their authorization callbacks; native hooks retain role traversal under the invoking control.

Source

fn transaction_timestamp_micros(&self) -> Option<i64>

Start of the current SQL transaction, in Unix microseconds.

Source

fn statement_timestamp_micros(&self) -> Option<i64>

Start of the current frontend SQL message, in Unix microseconds.

Source

fn lastval(&self) -> Result<i64>

Source

fn call_scalar_function( &self, _name: &str, _args: &[Value], ) -> Option<Result<Value>>

Source

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.

Source

fn call_bound_builtin_function_with_control( &self, binding: &FunctionBinding, args: &[(Option<String>, Value)], control: &ProductionControl<'_>, ) -> Option<Result<Produced<Value>>>

Session-backed execution keeps its existing result lifetime. A planning caller receives a separately admitted copy; the execution buffer is never retroactively classified as planning storage.

Source

fn has_scalar_functions(&self) -> bool

Source

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.

Source

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.

Source

fn read_range_input( &self, oid: u32, _text: &str, _control: &ProductionControl<'_>, ) -> Result<Produced<Value>>

Invoke the retained declaration’s input and optional canonical support. Read-only value catalogs never execute these effects.

Source

fn construct_range( &self, oid: u32, _bounds: RangeBoundsInput, _control: &ProductionControl<'_>, ) -> Result<Produced<Value>>

Construct an admitted declared range with its selected canonical support, without repeating endpoint conversion.

Source

fn construct_multirange( &self, oid: u32, _members: &[Value], _control: &ProductionControl<'_>, ) -> Result<Produced<Value>>

Normalize admitted members with the selected declaration’s comparison and canonical support.

Source

fn catalog_cast_scope(&self) -> Option<&CatalogCastScope>

Certify stable descriptors for bound/schema-qualified type names. Live custom catalogs decline by default; conversion callbacks, settings and unqualified namespace resolution are never covered by this capability.

Source

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.

Source

fn resolve_type_oid(&self, _oid: u32) -> Result<Option<ColumnType>, String>

Resolve an already admitted catalog type identity without name lookup or input privileges.

Source

fn resolve_type_name_with_control( &self, name: &str, control: &ProductionControl<'_>, ) -> Result<Option<Produced<ColumnType>>>

External catalogs own legacy descriptor construction; native catalogs admit selected metadata before producing it.

Source

fn resolve_type_oid_with_control( &self, oid: u32, control: &ProductionControl<'_>, ) -> Result<Option<Produced<ColumnType>>>

Source

fn type_oid_exists(&self, oid: u32) -> Result<bool, String>

Observe whether a physical type OID remains in the current catalog, including types without a scalar value carrier.

Source

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.

Source

fn cast_domain_with_control( &self, value: &Value, source: Option<&str>, target: &ColumnType, control: &ProductionControl<'_>, ) -> Result<Option<Produced<Value>>>

Apply domain input with the invoking value’s allowance and cancellation owners. Native catalogs override this method so base conversion and checks retain that control; the default admits results returned by an external legacy adapter.

Source

fn resolve_oid_alias_input_with_control( &self, ty: &ColumnType, name: &str, control: &ProductionControl<'_>, ) -> Result<Option<i64>>

Read an OID alias through the invoking planning owner. Native catalogs implement selected lookup directly; external adapters keep their historical input hooks.

Source

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.

Source

fn resolve_regclass(&self, _name: &str) -> Result<Option<i64>, String>

Resolve a relation name to the OID carrier used by regclass.

Source

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.

Source

fn resolve_regproc(&self, _name: &str) -> Result<Option<i64>>

Resolve a routine name that must name exactly one routine, as regproc input does.

Source

fn resolve_regprocedure(&self, _name: &str) -> Result<Option<i64>, String>

Resolve an exact routine signature to the OID carrier used by regprocedure.

Source

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.

Source

fn resolve_regrole(&self, _name: &str) -> Result<Option<i64>>

Resolve a regrole input while preserving hard input errors for direct casts.

Source

fn resolve_regnamespace(&self, name: &str) -> Result<Option<i64>>

Resolve a regnamespace input while preserving hard input errors for direct casts.

Source

fn resolve_regcollation(&self, name: &str) -> Result<Option<i64>>

Resolve regcollation input with the direct input function’s diagnostics.

Source

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.

Source

fn resolve_regtype_output( &self, _ty: &ColumnType, _oid: i64, ) -> Result<Option<String>, String>

Resolve one OID-backed alias type to its PostgreSQL text output.

Source

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.

Source

fn current_user(&self) -> Result<Option<String>, SQLError>

Source

fn session_user(&self) -> Result<Option<String>, SQLError>

Source

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).

Source

fn temporal_interval_style(&self) -> Result<Option<TemporalIntervalStyle>>

The live interval input/output convention. A catalog-only hook leaves the calling statement’s captured style in force.

Source

fn temporal_time_zone(&self) -> Result<Option<TemporalTimeZone>>

The validated zone of a live session. Detached value evaluation uses UTC.

Source

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).

Source

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.

Source

fn current_schemas( &self, _include_implicit: bool, ) -> Result<Option<Vec<String>>, String>

Resolve the existing schemas visible to the logical session.

Source

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.

Source

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.

Source

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.

Source

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.

Source

fn call_bound_user_function( &self, _binding: &FunctionBinding, _args: &[(Option<String>, Value)], ) -> Option<Result<Value>>

Source

fn call_bound_user_function_with_control( &self, binding: &FunctionBinding, args: &[(Option<String>, Value)], control: &ProductionControl<'_>, ) -> Option<Result<Produced<Value>>>

Run a selected routine with its ordinary execution contract, then admit a distinct destination for the planning result before copying it. Arguments remain borrowed from their producing owner throughout the call.

Source

fn routine_description_scope(&self) -> Option<RoutineDescriptionScope>

Identity for successful bound routine metadata. A mutable context must decline reuse or change this identity when its types, registry or role change. Returning a valid identity also admits retaining this hook for a fixed lateral source; default/custom hooks are reconstructed at their original boundary.

Source

fn call_bound_user_function_with_descriptions( &self, binding: &FunctionBinding, args: &[(Option<String>, Value)], _descriptions: &RoutineCallDescriptions, _control: &ProductionControl<'_>, ) -> Option<Result<Value>>

Optional metadata belongs to this prepared expression. Mutable/custom hooks preserve their ordinary invocation unless they explicitly support native scope validation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§