Re: Getting char * from timestamp in a composite type

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

Предыдущее
От: Marco Aurélio V. da Silva
Дата:
Сообщение: Problem with collector statistic
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem with collector statistic