Re: json api WIP patch - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: json api WIP patch
Date
Msg-id 50EC971C.3040003@dunslane.net
Whole thread Raw
In response to Re: json api WIP patch  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-hackers
On 01/08/2013 04:32 PM, Merlin Moncure wrote:
> On Tue, Jan 8, 2013 at 3:19 PM, Peter Eisentraut<peter_e@gmx.net>  wrote:
>> On 1/7/13 5:15 PM, Andrew Dunstan wrote:
>>> You (Merlin) have kindly volunteered to work on documentation, so before
>>> we go too far with that any bikeshedding on names, or on the
>>> functionality being provided, should now take place.
>> Hmm, I was going to say, this patch contains no documentation, so I have
>> no idea what it is supposed to do.  "Recently discussed" isn't a good
>> substitute for describing what the patch is supposed to accomplish.
> Why not?  There are functional examples in the docs and the purpose of
> the various functions was hashed out pretty well a couple weeks back,
> deficiencies corrected, etc.
>
> reference:http://postgresql.1045698.n5.nabble.com/json-accessors-td5733929.html

Well, at a high level the patch is meant to do two things: provide an 
API that can be used to build JSON processing functions easily, and 
provide some basic json processing functions built on the API. Those 
functions provide similar capabilities to the accessor functions that 
hstore has.

Perhaps also this will help. Here is the list of functions and operators 
as currently implemented. I also have working operators for the get_path 
functions which will be in a future patch.

All these are used in the included regression tests.

          Name           | Result data type |                           Argument data types

-------------------------+------------------+------------------------------------------------------------------------
 json_array_length       | integer          | json
 json_each               | SETOF record     | from_json json, OUT key text, OUT value json
 json_each_as_text       | SETOF record     | from_json json, OUT key text, OUT value text
 json_get                | json             | json, integer
 json_get                | json             | json, text
 json_get_as_text        | text             | json, integer
 json_get_as_text        | text             | json, text
 json_get_path           | json             | from_json json, VARIADIC path_elems text[]
 json_get_path_as_text   | text             | from_json json, VARIADIC path_elems text[]
 json_object_keys        | SETOF text       | json
 json_populate_record    | anyelement       | anyelement, json
 json_populate_recordset | SETOF anyelement | base anyelement, from_json json, use_json_as_text boolean DEFAULT false
 json_unnest             | SETOF json       | from_json json, OUT value json
                                    
 Name | Left arg type | Right arg type | Result type |          Description

------+---------------+----------------+-------------+--------------------------------
 ->   | json          | integer        | json        | get json array element
 ->   | json          | text           | json        | get json object field
 ->>  | json          | integer        | text        | get json array element as text
 ->>  | json          | text           | text        | get json object field as text



cheers

andrew




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Weird Assert failure in GetLockStatusData()
Next
From: Daniel Farina
Date:
Subject: Re: Cascading replication: should we detect/prevent cycles?