Re: Getting char * from timestamp in a composite type

From: Michael Akinde <michael(dot)akinde(at)met(dot)no>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting char * from timestamp in a composite type
Date: 2007-12-19 16:22:59
Message-ID: 47694563.5020009@met.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Martijn van Oosterhout wrote:
> 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..
Sigh... it's always the idiot bugs that are the hardest to see. Thanks a
lot.

Regards,

Michael A.

Attachment Content-Type Size
michael.akinde.vcf text/x-vcard 287 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2007-12-19 16:24:52 referential integrity and defaults, DB design or trick
Previous Message Martijn van Oosterhout 2007-12-19 15:52:10 Re: Getting char * from timestamp in a composite type