Skip site navigation (1) Skip section navigation (2)

Re: Getting char * from timestamp in a composite type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 17:01:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Michael Akinde <michael(dot)akinde(at)met(dot)no> writes:
>>> 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.

The other problem is that you're passing row not t to
GetAttributeByName.  If you don't have your compiler configured to bleat
about type mismatches like that, your days of C programming will be
bleak and painful.

			regards, tom lane

In response to


pgsql-general by date

Next:From: Tom LaneDate: 2007-12-19 17:09:27
Subject: Re: Problem with collector statistic
Previous:From: Ivan Sergio BorgonovoDate: 2007-12-19 16:24:52
Subject: referential integrity and defaults, DB design or trick

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group