Re: 9.3 Json & Array's - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: 9.3 Json & Array's
Date
Msg-id 524189B3.4060601@dunslane.net
Whole thread Raw
In response to Re: 9.3 Json & Array's  (Chris Travers <chris@2ndquadrant.com>)
Responses Re: 9.3 Json & Array's
List pgsql-hackers
On 09/24/2013 12:59 AM, Chris Travers wrote:
>
> I am still in the process of wrapping my head around the current JSON 
> logic.  I hope to produce a proof of concept that can later be turned 
> into a patch.  See my previous post on this topic.  Again 
> collaboration is welcome.
>
>


Feel free to ask questions.

The heart of the API is the event handlers defined in this stuct in 
include/utils/jsonapi.h:
   typedef struct JsonSemAction   {        void       *semstate;        json_struct_action object_start;
json_struct_actionobject_end;        json_struct_action array_start;        json_struct_action array_end;
json_ofield_actionobject_field_start;        json_ofield_action object_field_end;        json_aelem_action
array_element_start;       json_aelem_action array_element_end;        json_scalar_action scalar;   } JsonSemAction;
 


Basically there is a handler for the start and end of each non-scalar 
structural element in JSON, plus a handler for scalars.

There are several problems that will be posed by processing nested 
arrays and objects, including:
 * in effect you would need to construct a stack of state that could be   pushed and popped * JSON arrays aren't a very
goodmatch for SQL arrays - they are   unidimensional and heterogenous.
 


I'm not saying this can't be done - it will just take a bit of effort.

cheers

andrew




pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Strange hanging bug in a simple milter
Next
From: Andrew Dunstan
Date:
Subject: Re: PostgreSQL 9.3 beta breaks some extensions "make install"