Re: json api WIP patch

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: json api WIP patch
Date: 2013-01-08 22:01:00
Message-ID: 50EC971C.3040003@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Farina 2013-01-08 22:06:43 Re: Cascading replication: should we detect/prevent cycles?
Previous Message Tom Lane 2013-01-08 21:51:25 Re: Weird Assert failure in GetLockStatusData()