Search Postgresql Archives

Re: Getting char * from timestamp in a composite type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks, though that was an error caused by my attempt to copy-paste some readable example of code from the source file.

Matching the correct _out functions in the DirectFunctionCall fixed the segmentation fault problems I was seeing.

Regards,

Michael A.

Tom Lane wrote:
Michael Akinde <michael.akinde@xxxxxx> 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
  

begin:vcard
fn:Michael Akinde
n:Akinde;Michael
org:Meteorologisk Institutt, Norge;IT
adr;quoted-printable:;;Gaustadall=C3=A9en 30D;Oslo;;0313;Norge
email;internet:michael.akinde@xxxxxx
tel;work:22963379
tel;cell:45885379
x-mozilla-html:FALSE
url:http://www.met.no
version:2.1
end:vcard

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux