unbreak ::text for json in pg (#4722)

* unbreak ::text for json in pg

* better error handling
This commit is contained in:
HugoCasa
2024-11-15 18:35:21 +01:00
committed by GitHub
parent 366149ff65
commit 8734df138c
@@ -583,6 +583,11 @@ fn convert_val(
.unwrap_or(vec![]);
Ok(Box::new(bytes))
}
Value::Object(_) if arg_t == "text" || arg_t == "varchar" => {
Ok(Box::new(serde_json::to_string(value).map_err(|err| {
Error::ExecutionErr(format!("Failed to convert JSON to text: {}", err))
})?))
}
Value::Object(_) => Ok(Box::new(value.clone())),
Value::String(s) => Ok(Box::new(s.clone())),
_ => Err(Error::ExecutionErr(format!(