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
for example. Or someone could write an extension.
In response to
pgsql-hackers by date
|Next:||From: Andrew Dunstan||Date: 2012-01-31 20:23:02|
|Subject: Re: [GENERAL] pg_dump -s dumps data?!|
|Previous:||From: Martijn van Oosterhout||Date: 2012-01-31 20:02:59|
|Subject: Re: pg_dump -s dumps data?!|