The Heroku Postgres guys have been playing with this idea [2] using the PL/V8 plugin, which embeds Javascript as a supported language inside Postgres (and thus makes it trivial to implement the json_project_key function), but if Postgres is going to natively support JSON parsing then it shouldn't take an addon module to achieve this.
[1] Attempting to forestall the thread-jacking: I know NoSQL databases have other benefits besides their data model, but for some applications that's certainly one of the benefits. [2] https://gist.github.com/1150804
Reading from the linked article I would assume that they were kind of running out of time for the feature freeze.
I would expect the querying functions to be added in the release after this, or before in form of an extension.
I'm not on their core developer mailing lists, but I presume this is because of a prioritization of stability over most everything else.
They'll take a stable half-feature over a buggy full-feature at any given deadline. What matters is that over time they patiently and carefully expand those half features.
The most visible example is the slowly increasing coverage of replication. This JSON feature is another example -- I expect it will grow in future into a fuller feature set.
They already have that: http://www.postgresql.org/docs/9.1/static/hstore.html
That said, having seen 'core type' I instantly imagined being able to query based on JSON properties, which doesn't appear to be the case. Not surprising, because it would be a huge amount of work.. but it's nice to imagine.
(before anyone says anything- yes, I know NoSQL exists. But a hybrid solution using Postgres would be very interesting)
It's a key-value store that allows querying, which is what I think you are lamenting in your comment. Here's a bit more about how to query and index with hstore: http://lwn.net/Articles/406385/. It's pretty simple and doesn't have anywhere near the number of querying possibilities that MongoDB has, but it can be used for on-the-fly column names (similar to JSON). You can only query on the root node's children, unlike the open-ended possibilities in NoSQL.
I'm (quite happily) tied to Postgres because I'm using PostGIS, but the ability to add freeform data to a location would be ideal. Looks like I may already have a solution here.
SELECT users.id, jsonpath('$.timezone', users.preferences_json) AS tz FROM users WHERE tz LIKE 'America/%';If JSON support means first-class type support in a nested object, that's a huge leap forward.
SELECT xml_user_roster( 1 );
Given the extensive use of JSON in jQuery (Ajax) web applications, integrating JSON with PostgreSQL is smart. It allows the application code to vary independently of the business code that relies on JSON as a data interchange format.That said, it would be great if JSON and XML were pluggable modules (similar to PL/R) that could be installed when needed.
I suspect I am not a big fan of abstractions.
SQLight. Nice pick.
So, if you already have an environment where you are certain you are inserting valid JSON, it's not much different than just using the text type today.
Today, yes.
Tomorrow, when you launch an API and suddenly hundreds of different apps are talking to your systems, no.
Putting rich descriptions of data right next to the data is a good thing in the long run.
http://people.planetpostgresql.org/andrew/index.php?/archive...