Re: understanding Datum -> char * -> Datum conversions - Mailing list pgsql-hackers

From Karel Zak
Subject Re: understanding Datum -> char * -> Datum conversions
Date
Msg-id Pine.LNX.3.96.1000525114728.31465F-100000@ara.zf.jcu.cz
Whole thread Raw
In response to Re: understanding Datum -> char * -> Datum conversions  (Louis-David Mitterrand <cunctator@apartia.ch>)
Responses Re: understanding Datum -> char * -> Datum conversions  (Louis-David Mitterrand <cunctator@apartia.ch>)
List pgsql-hackers
> 
> 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



pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: AW: SQL3 UNDER
Next
From: Zeugswetter Andreas SB
Date:
Subject: AW: AW: SQL3 UNDER