Louis-David Mitterrand <cunctator(at)apartia(dot)ch> writes:
> Can I do
> double result = 10.5; /* for example */
> SPI_modifytuple(relation, tupdesc, &attnum,Float32GetDatum(&result),NULL);
> ^^^
I think you could get away with that in this example. The critical
question of course is whether the Datum pointer will continue to
be used after your routine exits. But SPI_modifytuple should have
created the new tuple (and copied the values of pass-by-reference
items, such as float8s, into it) before returning.
BTW you should be using Float64GetDatum. There's no real difference
in those two macros at the moment, but it's a type error that might
bite you someday (like as soon as you need to convert this code to
the new fmgr ;-)).
regards, tom lane