Re: Getting char * from timestamp in a composite type

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Michael Akinde <michael(dot)akinde(at)met(dot)no>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting char * from timestamp in a composite type
Date: 2007-12-19 15:52:10
Message-ID: 20071219155210.GA24426@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Dec 19, 2007 at 04:40:38PM +0100, Michael Akinde wrote:
> As I understand it, I should be able to do something like (assuming
> "time" is the attribute name):
>
> bool isNull;
> HeapTupleHeader t = DatumGetHeapTupleHeader(row);
> Datum var = GetAttributeByName( row, "time", & isNull );
> // Check for null
> char * ret = DatumGetCString( DirectFunctionCall1(textout, var ) );

That's not going to work. textout wants a text datum. Try calling
timestamp_out instead...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Akinde 2007-12-19 16:22:59 Re: Getting char * from timestamp in a composite type
Previous Message Erik Jones 2007-12-19 15:49:45 Re: thank you