diff --git a/lib/src/sql/function.rs b/lib/src/sql/function.rs index 177d0d29..fe237d35 100644 --- a/lib/src/sql/function.rs +++ b/lib/src/sql/function.rs @@ -86,6 +86,10 @@ impl Function { _ => unreachable!(), } } + /// Check if this function is a custom function + pub fn is_custom(&self) -> bool { + matches!(self, Self::Custom(_, _)) + } /// Check if this function is a rolling function pub fn is_rolling(&self) -> bool { match self { diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index 1af4d7cb..46e5cece 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -1417,7 +1417,7 @@ impl Value { Value::Block(v) => v.writeable(), Value::Array(v) => v.iter().any(Value::writeable), Value::Object(v) => v.iter().any(|(_, v)| v.writeable()), - Value::Function(v) => v.args().iter().any(Value::writeable), + Value::Function(v) => v.is_custom() || v.args().iter().any(Value::writeable), Value::Subquery(v) => v.writeable(), Value::Expression(v) => v.l.writeable() || v.r.writeable(), _ => false,