Re: JSON for PG 9.2

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Peter van Hardenberg <pvh@pvh.ca>
Cc: Josh Berkus <josh@agliodbs.com>, pgsql-hackers@postgresql.org, Joseph Adams <joeyadams3.14159@gmail.com>
Date: 2011-12-13T01:36:02Z
Lists: pgsql-hackers

On 12/12/2011 07:51 PM, Peter van Hardenberg wrote:
> We reached out to Joseph to see if we could help sponsor the project,
> but never really heard back from him.
>
> Because we haven't heard from him in a while we've been using PL/V8 to
> validate a JSON datatype simulated by a DOMAIN with a simple
> acceptance function. (See below.) This is not ideally performant but
> thanks to V8's JIT the JSON parser is actually reasonably good.
>
> I think releasing something simple and non-performant with reasonable
> semantics would be the best next step. If it were up to me, I'd
> probably even try to just land PL/V8 as PL/JavaScript for 9.2 if the
> crash bugs and deal breakers can be sifted out.
>
> PL/V8 is fast, it's sandboxed, and while it doesn't provide GIN or
> GIST operators out of the box, maybe those could be motivated by its
> inclusion.
>
> Andrew, you've been down in the guts here, what do you think?

The trouble with using JSON.parse() as a validator is that it's probably 
doing way too much work. PLV8 is cool, and I keep trying to get enough 
time to work on it more, but I don't think it's a substitute for a JSON 
type with a purpose built validator and some native operations. I think 
these efforts can continue in parallel.

cheers

andrew