Re: json results parsing

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: json results parsing
Дата
Msg-id 87wovjxovd.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: json results parsing  (Charles Cui <charles.cui1984@gmail.com>)
Список pgsql-hackers
>>>>> "Charles" == Charles Cui <charles.cui1984@gmail.com> writes:

 Charles> Thanks you guys for answering my questions, and sorry for confusion.
 Charles> To clarify, I think my question is functions like json_each or
 Charles> json_object_keys() are
 Charles> set returning functions (
 Charles> https://www.postgresql.org/docs/9.5/static/functions-srf.html),
 Charles> which means it returns a set of results into a Datum.

No. Set-returning functions follow a somewhat complex call protocol that
may involve the function being called multiple times (returning one row
each time as a composite Datum) or may involve the function being called
once and returning a tuplestore (not as the return value but via the
ReturnSetInfo struct).

I would not try calling a SRF directly from C code without going through
SPI (i.e. setting up and running an actual query from inside your
function).

I definitely think you should be looking at pg_parse_json instead.

-- 
Andrew (irc:RhodiumToad)


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

Предыдущее
От: Charles Cui
Дата:
Сообщение: Re: json results parsing
Следующее
От: Chapman Flack
Дата:
Сообщение: Re: json results parsing