Does anyone happen to have a server-side C-language example of
using the Version-1 calling conventions with the NUMERIC data
type? Is it possible? For example, instead of writing:
PG_FUNCTION_INFO_V1(add_one);
Datum add_one(PG_FUNCTION_ARGS)
{
int32 arg = PG_GETARG_INT32(0);
PG_RETURN_INT32(arg + 1);
}
I'd like to do the equivalent with NUMERIC. I see the
appropriate macros declared in utils/numeric.h. But I'm not sure
I understand the representation of NumericData:
varlen <- self-explanatory
n_weight <- ??
n_rscale <- scale of numeric
n_sign_dscale <- ??
n_data[1] <- ?? is this BCD?
Are there any helper functions available to the C-language
server-side developer wrt numeric?
Thanks for any tips,
Mike Mascari
mascarm(at)mascari(dot)com