pgrx_pg_sys::submodules::htup

Function heap_getattr

Source
pub unsafe fn heap_getattr(
    tup: *mut HeapTupleData,
    attnum: i32,
    tupleDesc: TupleDesc,
    isnull: &mut bool,
) -> Datum
Expand description

Extract an attribute of a heap tuple and return it as a Datum. This works for either system or user attributes. The given attnum is properly range-checked.

If the field in question has a NULL value, we return a zero Datum and set *isnull == true. Otherwise, we set *isnull == false.

ยงSafety

  • tup is the pointer to the heap tuple.
  • attnum is the 1-based attribute number of the column (field) caller wants.
  • tupleDesc is a pointer to the structure describing the row and all its fields.

These things must complement each other correctly