>
> The problem is converting the Datum to a base C type in order to be able
> to modify it.
>
> in pgsql/contrib/spi/timetravel.c there is an example which modifies
> date columns and uses DatumGetInt32 to convert them. But this is
> confusing because (1) Tom Lane says that datetime columns are double and
> one should use DatumGetPointer (how do I use the pointer after?) and (2)
> DatumGetInt32 doesn't seem to return the number of seconds.
See in PG's backend source files:
c.h - for datetype definition and Datum macros, we have Datum macros for double/float types too.
buildin.h - for datetype conversion.utils/timestamp.h ...etc.
and directory utils/adt for inspiration "how work
with pg types :-)
I believe that you will understand.
Karel