Ensure custom functions can write data

Closes #1808
This commit is contained in:
Tobie Morgan Hitchcock 2023-04-13 20:31:22 +01:00
parent 2a797f6f3b
commit 7448cd1305
2 changed files with 5 additions and 1 deletions

View file

@ -86,6 +86,10 @@ impl Function {
_ => unreachable!(), _ => 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 /// Check if this function is a rolling function
pub fn is_rolling(&self) -> bool { pub fn is_rolling(&self) -> bool {
match self { match self {

View file

@ -1417,7 +1417,7 @@ impl Value {
Value::Block(v) => v.writeable(), Value::Block(v) => v.writeable(),
Value::Array(v) => v.iter().any(Value::writeable), Value::Array(v) => v.iter().any(Value::writeable),
Value::Object(v) => v.iter().any(|(_, v)| v.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::Subquery(v) => v.writeable(),
Value::Expression(v) => v.l.writeable() || v.r.writeable(), Value::Expression(v) => v.l.writeable() || v.r.writeable(),
_ => false, _ => false,