Re: understanding Datum -> char * -> Datum conversions

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: ldm(at)apartia(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: understanding Datum -> char * -> Datum conversions
Date: 2000-05-25 10:03:55
Message-ID: Pine.LNX.3.96.1000525114728.31465F-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2000-05-25 10:04:34 Re: AW: AW: SQL3 UNDER
Previous Message Louis-David Mitterrand 2000-05-25 09:53:54 Re: understanding Datum -> char * -> Datum conversions