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_action object_end;
json_struct_action array_start;
json_struct_action array_end;
json_ofield_action object_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 good match 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
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers