Open Feyko opened 8 months ago
Spoke too soon.
Hm, this remains a problem even on develop
. Joy.
This code currently compiles on develop:
use pgrx::prelude::*;
#[pg_extern]
fn aggregate_test(_record: PgHeapTuple<AllocatedByRust>){}
#[derive(Clone, Default, PostgresType)]
#[bikeshed_postgres_type_manually_impl_from_into_datum]
pub struct AggregateIncrementalRecords {
attr_count: i16,
}
impl IntoDatum for AggregateIncrementalRecords {
fn into_datum(self) -> Option<pg_sys::Datum> {
todo!()
}
fn type_oid() -> pg_sys::Oid {
todo!()
}
}
impl FromDatum for AggregateIncrementalRecords {
unsafe fn from_polymorphic_datum(_: pg_sys::Datum, _: bool, _: pg_sys::Oid) -> Option<Self> {
todo!()
}
}
#[pg_aggregate]
impl Aggregate for AggregateIncrementalRecords {
const INITIAL_CONDITION: Option<&'static str> = Some(r#"{ "attr_count": 0 }"#);
type Args = PgHeapTuple<'static, AllocatedByRust>;
fn state(
current: Self::State,
_arg: Self::Args,
_fcinfo: pg_sys::FunctionCallInfo
) -> Self::State {
return current
}
}
fn main() {}
As does this:
use serde::{Serialize, Deserialize};
use pgrx::prelude::*;
#[pg_extern]
fn aggregate_test(_record: PgHeapTuple<AllocatedByRust>){}
#[derive(Clone, Default, PostgresType, Serialize, Deserialize)]
pub struct AggregateIncrementalRecords {
attr_count: i16,
}
#[pg_aggregate]
impl Aggregate for AggregateIncrementalRecords {
const INITIAL_CONDITION: Option<&'static str> = Some(r#"{ "attr_count": 0 }"#);
type Args = PgHeapTuple<'static, AllocatedByRust>;
fn state(
current: Self::State,
_arg: Self::Args,
_fcinfo: pg_sys::FunctionCallInfo
) -> Self::State {
return current
}
}
fn main() {}
Oh, I'm a fool, I keep forgetting schema gen is a separate pass from build.
Okay, Okay, I don't believe this is supposed to be supported, really, but it's not producing a useful error.
Tested with pgrx
0.11.3
&0.12.0-alpha.0
Error:
Repros: