Re: JSON for PG 9.2

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: JSON for PG 9.2
Date: 2012-01-31 20:15:42
Message-ID: 4F284BEE.5020903@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/31/2012 02:49 PM, Merlin Moncure wrote:
> The major hole in functionality I see for heavy json users is the
> reverse; how do you get json back into the database? With xml, at
> least you could (ab)use xpath for that...with json you have to rely on
> add-on support and/or ad hoc string parsing (that is, unless I'm
> missing something -- I just noted Robert's commit of the JSON type).
> since we can do: select array_to_json(array(select foo from foo)); it
> seems natural to be able to want do do something like: WITH foos AS
> (SELECT a_json_var::foo[] AS f) ( INSERT INTO foo SELECT (f).* FROM
> foos ); Of course, you'd have to have non-anonymous (that is, defined
> with CREATE TYPE AS) types defined to receive all the data, but that's
> not so bad. Also, could xxx_to_json be hypothetically executed via
> casts? e.g. select array(select foo from foo)::json;

At some stage there will possibly be some json-processing (as opposed to
json-producing) functions, but not in 9.2 - it's too late for that.
Until then there is PLV8: see
<http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html>
for example. Or someone could write an extension.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2012-01-31 20:23:02 Re: [GENERAL] pg_dump -s dumps data?!
Previous Message Martijn van Oosterhout 2012-01-31 20:02:59 Re: pg_dump -s dumps data?!