Re: json results parsing

From: Charles Cui <charles(dot)cui1984(at)gmail(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Aleksander Alekseev <a(dot)alekseev(at)postgrespro(dot)ru>, Aleksandr Parfenov <a(dot)parfenov(at)postgrespro(dot)ru>, Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: json results parsing
Date: 2018-06-01 00:20:24
Message-ID: CA+SXE9sJ5sfyA5z_74UkoWQcaX2N2w6cDsDpCw0OQgTvdCcggg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks you guys for answering my questions, and sorry for confusion.
To clarify, I think my question is functions like json_each or
json_object_keys() are
set returning functions (
https://www.postgresql.org/docs/9.5/static/functions-srf.html)
which means it returns a set of results into a Datum.
I am wondering how to parse the Datum? I know there are functions like
DatumGetCString()
which parse the Datum into a cstring. Are there any helpers for set
returning functions?

2018-05-30 23:00 GMT-07:00 Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>:

> >>>>> "Charles" == Charles Cui <charles(dot)cui1984(at)gmail(dot)com> writes:
>
> Charles> Hi mentors and hackers,
> Charles> Found the json API page here
> Charles> https://www.postgresql.org/docs/9.3/static/functions-json.html
>
> Charles> For some APIs, it returns set of results, for example,
> Charles> json_each(json) and json_object_keys().
>
> Charles> Basically, I want to call these json API inside a plugin,
>
> If you want to process the whole of a json (not jsonb) value inside a
> plugin, then maybe pg_parse_json is what you should be looking at rather
> than the SQL-callable functions.
>
> For jsonb, there's an iterator interface (JsonbIteratorInit/
> JsonbIteratorNext)
>
> --
> Andrew (irc:RhodiumToad)
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-06-01 01:56:24 Re: json results parsing
Previous Message Noah Misch 2018-06-01 00:06:37 Re: PostgreSQL 11 beta1 on AIX 7.2 : 2 failures in 32bit mode