Re: printing JsonbPair values of input JSONB on server side?

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: printing JsonbPair values of input JSONB on server side?
Дата
Msg-id 87k1gvyizo.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: printing JsonbPair values of input JSONB on server side?  (T L <tinlyx@gmail.com>)
Ответы Re: printing JsonbPair values of input JSONB on server side?
Список pgsql-general
>>>>> "T" == T L <tinlyx@gmail.com> writes:

 T>         //problem lines!!! //either elog crashes pg server
 T>         char *buf = pnstrdup(ptr->key.val.string.val,
 T>                              ptr-> key.val.string.len);
 T>         elog(NOTICE, "print_kv_pair(): k = %s",
 T> (ptr->key).val.string.val);  //debug

It doesn't help to make a null-terminated copy of the string if you're
then just going to try and print the original.

    elog(NOTICE, "print_kv_pair(): k = %s", buf);

 T>         elog(NOTICE, "print_kv_pair(): v = %s",
 T> DatumGetCString(DirectFunctionCall1(numeric_out,
 T>                 NumericGetDatum(ptr->value.val.numeric))) ); //debug

That should work, _provided_ that value.type == jbvNumeric - did you
consider checking that first?

-- 
Andrew (irc:RhodiumToad)


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