Re: json api WIP patch

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Merlin Moncure <mmoncure@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2013-01-07T22:15:47Z
Lists: pgsql-hackers

Attachments

On 01/07/2013 10:25 AM, Merlin Moncure wrote:

>
> the patch looks fabulous.  There are a few trivial whitespace issues
> yet and I noticed a leaked hstore comment@ 2440:
> + 	/*
> + 	 * if the input hstore is empty, we can only skip the rest if we were
> + 	 * passed in a non-null record, since otherwise there may be issues with
> + 	 * domain nulls.
> + 	 */
>


Here is a patch that has all the functionality I'm intending to provide.

The API is improved some, with the parser now keeping track of the 
nesting levels instead of callers having to do so, and a constructor 
function provided for JsonLexContext objects.

The processing functions have been extended to provide populate_record() 
and populate_recordset() functions.The latter in particular could be 
useful in decomposing a piece of json representing an array of flat 
objects (a fairly common pattern) into a set of Postgres records in a 
single pass.

The main thing I'm going to concentrate on now is making sure that this 
doesn't leak memory. I'm sure there's some tightening required in that 
area. Any eyeballs there will be greatly appreciated. There are also a 
couple of very minor things to clean up.

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.


cheers

andrew