uqa_sql/semantics/rules/
binding.rs1mod actions;
10pub use actions::{
11 MutationRuleInput, OwnedInsertRuleQueries, OwnedMutationRuleInput, OwnedRuleQueryInput,
12 OwnedRuleQueryResolver, RuleAction, RuleInputColumns, RuleMutation, RuleQueryInput,
13 RuleQueryResolver,
14};
15
16pub struct RuleColumnMetadata {
17 pub ty: crate::ast::ColumnType,
18 pub collation_oid: Option<u32>,
19}
20
21impl RuleColumnMetadata {
22 pub fn bind_input(&self, expression: crate::ScalarExpr) -> crate::ScalarExpr {
24 if !crate::schema::composites::type_is_collatable(&self.ty) {
25 return expression;
26 }
27 let oid = self.collation_oid.unwrap_or_else(|| {
28 u32::try_from(crate::catalog::type_metadata::pg_type_collation_oid(
29 &self.ty,
30 ))
31 .expect("type collation identity")
32 });
33 crate::ScalarExpr::Collated {
34 expr: Box::new(expression),
35 ty: self.ty.clone(),
36 collation: crate::ir::ResultCollation::new(
37 crate::catalog::collations::derivation::Derivation::implicit(i64::from(oid)),
38 oid,
39 ),
40 }
41 }
42}