Re: JSON for PG 9.2
От | Andrew Dunstan |
---|---|
Тема | Re: JSON for PG 9.2 |
Дата | |
Msg-id | 4F284BEE.5020903@dunslane.net обсуждение исходный текст |
Ответ на | Re: JSON for PG 9.2 (Merlin Moncure <mmoncure@gmail.com>) |
Список | 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
В списке pgsql-hackers по дате отправления: