Re: printing JsonbPair values of input JSONB on server side?
В списке pgsql-general по дате отправления:
| От | Andrew Gierth |
|---|---|
| Тема | Re: printing JsonbPair values of input JSONB on server side? |
| Дата | |
| Msg-id | 87r2b4x7pg.fsf@news-spur.riddles.org.uk обсуждение |
| Ответ на | 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 line!!!
T> // elog(NOTICE, "print_kv_pair(): k = %s, v = %s",
T> ptr-> key.val.string.val, numeric_out(ptr->value.val.numeric));
string.val isn't a C string (notice the "not null terminated" comment in
the structure definition), and you can't call numeric_out like that.
Either of those would crash it.
You could use pnstrdup to get a valid C string, and use
DatumGetCString(DirectFunctionCall1(
numeric_out,
NumericGetDatum(ptr->value.val.numeric)))
to get the numeric value as a C string.
--
Andrew (irc:RhodiumToad)
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера