You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to use impl Aggregate to define aggregate function (to ensure it use aggregate context). But my input args is reference with lifetime, so it is hard to impl Aggregate trait.
Maybe it is another way to add a attr aggcontext for pg_extern? And generate code like pgrx::pg_sys::submodules::panic::pgrx_extern_c_guard(move || { let mut agg_context: *mut ::pgrx::pg_sys::MemoryContextData = std::ptr::null_mut(); if ::pgrx::pg_sys::AggCheckCallContext(_fcinfo, &mut agg_context) == 0 { ::pgrx::error!("aggregate function called in non-aggregate context",); } let old_context = ::pgrx::pg_sys::MemoryContextSwitchTo(agg_context); let result = _vectors_vecf32_aggregate_avg_sum_sfunc_wrapper_inner(_fcinfo); ::pgrx::pg_sys::MemoryContextSwitchTo(old_context); result }) ?
Thanks for your great work.
The text was updated successfully, but these errors were encountered:
We are working on the necessary prerequisite code for making that sort of thing possible like right now. We can take a look at revising impl Aggregate for that when it lands.
I would rather not add ad-hoc functionality like that to pg_extern.
I want to use impl Aggregate to define aggregate function (to ensure it use aggregate context). But my input args is reference with lifetime, so it is hard to impl Aggregate trait.
Maybe it is another way to add a attr
aggcontext
forpg_extern
? And generate code likepgrx::pg_sys::submodules::panic::pgrx_extern_c_guard(move || { let mut agg_context: *mut ::pgrx::pg_sys::MemoryContextData = std::ptr::null_mut(); if ::pgrx::pg_sys::AggCheckCallContext(_fcinfo, &mut agg_context) == 0 { ::pgrx::error!("aggregate function called in non-aggregate context",); } let old_context = ::pgrx::pg_sys::MemoryContextSwitchTo(agg_context); let result = _vectors_vecf32_aggregate_avg_sum_sfunc_wrapper_inner(_fcinfo); ::pgrx::pg_sys::MemoryContextSwitchTo(old_context); result })
?Thanks for your great work.
The text was updated successfully, but these errors were encountered: