>>>>> "T" == T L <tinlyx@gmail.com> writes:
T> //Problem line!!!
T> // elog(NOTICE, "print_kv_pair(): k = %s, v = %s",
T> ptr-> key.val.string.val, numeric_out(ptr->value.val.numeric));
string.val isn't a C string (notice the "not null terminated" comment in
the structure definition), and you can't call numeric_out like that.
Either of those would crash it.
You could use pnstrdup to get a valid C string, and use
DatumGetCString(DirectFunctionCall1(
numeric_out,
NumericGetDatum(ptr->value.val.numeric)))
to get the numeric value as a C string.
--
Andrew (irc:RhodiumToad)