Re: Getting char * from timestamp in a composite type

Поиск
Список
Период
Сортировка
От Michael Akinde
Тема Re: Getting char * from timestamp in a composite type
Дата
Msg-id 476A22F9.3030204@met.no
обсуждение исходный текст
Ответ на Re: Getting char * from timestamp in a composite type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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@met.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 

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Way to avoid expensive Recheck Cond in index lookup?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Trouble running PostgreSQL server / Server must be started under certain locale.