Open
Description
In Rust, panics tend to be 2nd class as they may result in various lock poisoning, slower perf, etc. Yet, it seems #[pg_extern]
expects most functions to be returning the actual value rather than a Result<T, E>
. I tried to look for any documentation, and saw a few examples like this one where the error type is Box<dyn std::error::Error + Send + Sync + 'static>
. What is best approach to errors, and where can this be documented?
#[pg_extern]
fn result_table() -> Result<
Option<::pgrx::iter::TableIterator<'static, (name!(a, Option<i32>), name!(b, Option<i32>))>>,
Box<dyn std::error::Error + Send + Sync + 'static>,
> {
Ok(Some(TableIterator::new(vec![(Some(1), Some(2))])))
}