Re: json results parsing - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: json results parsing
Date
Msg-id 20180531033253.GA1161@paquier.xyz
Whole thread Raw
In response to json results parsing  (Charles Cui <charles.cui1984@gmail.com>)
List pgsql-hackers
On Wed, May 30, 2018 at 08:16:18PM -0700, Charles Cui wrote:
> Basically, I want to call these json API inside a plugin, and the return
> value for these APIs are Datum. I am wondering how to parse a set of json
> results from Datum in postgresql? Seems the helper functions I am aware of
> are only for simple types. Are there any examples to demonstrate the best
> practice of how to do that?

When it comes to the manipulation of data which uses a given data type,
you may want to look at how the input and output functions of this data
type work to understand how they can be fetched and saved.  In the case
of json, that would be looking at respectively json_in and json_out.
Each type (and its array representation) has its own row within the
system catalog pg_type, where the input function is marked with
typinput, and the output as typoutput.

I hope that helps.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Euler Taveira
Date:
Subject: Re: ALTER CONSTRAINT change action
Next
From: Andrew Gierth
Date:
Subject: Re: json results parsing