pub struct RuleQueryResolver {
pub table: String,
pub columns: Vec<(String, Result<Expr, SQLError>)>,
pub old: BTreeMap<String, Expr>,
pub expressions: BTreeMap<InternalColumnRef, ExpressionPlan>,
}Expand description
NEW fields are expressions over the input query, so unused fields never run.
Fields§
§table: String§columns: Vec<(String, Result<Expr, SQLError>)>§old: BTreeMap<String, Expr>§expressions: BTreeMap<InternalColumnRef, ExpressionPlan>Implementations§
Source§impl RuleQueryResolver
impl RuleQueryResolver
pub fn condition( &mut self, catalog: CatalogRoutineAnalysisContext<'_>, rule: &StoredRule, columns: &[ColumnDef], subject: &RoleReference, ) -> Result<Option<ExpressionPlan>, SQLError>
Source§impl RuleQueryResolver
impl RuleQueryResolver
Sourcepub fn input_columns(
&self,
context: RuleAnalysisContext<'_>,
insert: &InsertPlan,
action: &Statement,
condition: Option<&Expr>,
target_columns: &BTreeSet<String>,
) -> Result<Option<(BTreeSet<usize>, usize)>, SQLError>
pub fn input_columns( &self, context: RuleAnalysisContext<'_>, insert: &InsertPlan, action: &Statement, condition: Option<&Expr>, target_columns: &BTreeSet<String>, ) -> Result<Option<(BTreeSet<usize>, usize)>, SQLError>
Describe the source positions referenced by an action and its condition before planner pruning.
pub fn from_insert( context: RuleAnalysisContext<'_>, insert: &InsertPlan, relation: InternalRelationId, ) -> Result<Self, SQLError>
Trait Implementations§
Source§impl VariableResolver for RuleQueryResolver
impl VariableResolver for RuleQueryResolver
Source§fn resolve_name(
&mut self,
_name: &str,
) -> Result<Option<ResolvedVariable>, SQLError>
fn resolve_name( &mut self, _name: &str, ) -> Result<Option<ResolvedVariable>, SQLError>
Current value of an unqualified name.
Ok(None) leaves the
column reference for the engine to resolve.Source§fn resolve_qualified(
&mut self,
_qualifier: &str,
_column: &str,
) -> Result<Option<ResolvedVariable>, SQLError>
fn resolve_qualified( &mut self, _qualifier: &str, _column: &str, ) -> Result<Option<ResolvedVariable>, SQLError>
Current value of
qualifier.column (record field access).Source§fn resolve_param(
&mut self,
_index: usize,
) -> Result<Option<ResolvedVariable>, SQLError>
fn resolve_param( &mut self, _index: usize, ) -> Result<Option<ResolvedVariable>, SQLError>
Value of a positional
$n reference (function arguments).Source§fn rewrite_name(&mut self, name: &str) -> Result<Option<Expr>, SQLError>
fn rewrite_name(&mut self, name: &str) -> Result<Option<Expr>, SQLError>
Optional expression-level rewrite hook. The default preserves the variable-substitution behavior used by PL/pgSQL while allowing catalog lifecycle code to rewrite a reference without fabricating a literal value.
Source§fn rewrite_qualified(
&mut self,
qualifier: &str,
column: &str,
) -> Result<Option<Expr>, SQLError>
fn rewrite_qualified( &mut self, qualifier: &str, column: &str, ) -> Result<Option<Expr>, SQLError>
Expression-level counterpart of
Self::resolve_qualified.Source§fn rewrite_qualified_whole_row(
&mut self,
qualifier: &str,
) -> Result<Option<Expr>, SQLError>
fn rewrite_qualified_whole_row( &mut self, qualifier: &str, ) -> Result<Option<Expr>, SQLError>
Resolve
qualifier.* when it appears in a scalar context and therefore denotes one composite whole-row value rather than a projection list.Source§fn resolve_parameter(
&mut self,
reference: &PLpgSQLVariableReference,
) -> Result<Option<SQLParam>>
fn resolve_parameter( &mut self, reference: &PLpgSQLVariableReference, ) -> Result<Option<SQLParam>>
Read a prepared variable with its selected concrete type. Existing resolvers
retain textual resolution; typed activation records can preserve their
descriptor without spelling and resolving it again.
Source§fn parameter_type(&self, name: &str) -> Option<ColumnType>
fn parameter_type(&self, name: &str) -> Option<ColumnType>
Concrete parameter metadata for a declared datum; catalog implementations
preserve user-type identity instead of inferring from a carrier value.
Source§fn rewrite_qualified_star(
&mut self,
_qualifier: &str,
) -> Result<Option<Vec<Expr>>>
fn rewrite_qualified_star( &mut self, _qualifier: &str, ) -> Result<Option<Vec<Expr>>>
Expand
qualifier.* when the containing SQL construct treats it as a
list item. Scalar binding deliberately does not call this hook because
PostgreSQL treats the same syntax as a composite whole-row value in
scalar contexts.Source§fn rewrite_param(&mut self, index: usize) -> Result<Option<Expr>>
fn rewrite_param(&mut self, index: usize) -> Result<Option<Expr>>
Expression-level counterpart of
Self::resolve_param.Auto Trait Implementations§
impl !RefUnwindSafe for RuleQueryResolver
impl !UnwindSafe for RuleQueryResolver
impl Freeze for RuleQueryResolver
impl Send for RuleQueryResolver
impl Sync for RuleQueryResolver
impl Unpin for RuleQueryResolver
impl UnsafeUnpin for RuleQueryResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more